페이지에서 입력받은 값을 디비에 있는 값과 비교해서
맞으면 출력이나 alert를 주려고 하는데.... 널값만 입력되는건지;
에러가자꾸나네요 ㅠㅠ
<%@ page language="java" contentType="text/html; charset=EUC-KR"
import="java.sql.*" pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<input type=text id=loginId value="" onkeyup=onKeyupPasswd(event)>
</body>
</html>
<script type="text/javascript">
function onKeyupPasswd(ev){
var objLoginInfo = document.getElementById("loginId");
var evKeyup = null;
if(ev) // firefox
evKeyup = ev;
else // explorer
evKeyup = window.event;
if(evKeyup.keyCode == 13){ // enter key code:13
// document.getElementById("passwd").blur();
//fnLogin();
<%
String id = request.getParameter("objLoginInfo");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String db_code=null;
//Boolean isLogin = false;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/mobileskhu?"
+ "characterEncoding=utf-8", "root_user",
"tkdcjs2");
stmt = (Statement) conn.createStatement();
// 현재 페이지의 글 가져오기
rs = stmt.executeQuery("select * from student where code='"
+ id + "'");
while (rs.next()) {
db_code = rs.getString("code");
}
if (db_code.equals(id)) {
out.print("성공");
}
/*
if (!isLogin) {
out.print("회원정보가 없습니다. ");
} */
}
catch (ClassNotFoundException cnfe) {
out.println("해당 클래스를 찾을 수 없습니다." + cnfe.getMessage());
}
catch (SQLException se) {
out.println(se.getMessage());
}
try {
conn.close();
} catch (SQLException e) {
out.println(e.getMessage());
}
%>
} // end if
} // end function onKeyupPasswd()
</script>