<script type="text/javascript">
function checkF()
{
var f = document.user_info;
if(f.userID.value.length < 2 || f.userID.value.length >16)
{
alter("아이디는 2~16자 이내로 입력해야 합니다.");
f.userID.focus();
return false;
}
else if(f.userPW.value.length < 6)
{
alter("비밀번호는 6자 이상으로 입력해야 합니다.");
f.userPW.focus();
return false;
}
else if(f.userMAIL.value == "")
{
alter("이메일을 입력해야 합니다.");
f.userMAIL.focus();
return false;
}
else return true;
}
</script>
</head>
<body>
Home > 회원 가입
<hr>
<form action="insertDB.jsp" name="user_info" method="post" onsubmit="return checkF()">
<fieldset style="width:230px">
<legend> 회원 가입 화면 </legend><p>
아이디 : <br>
<input type="text" size = "16" name="userID"><br><br>
비밀번호 : <br>
<input type="password" size = "16" name="userPW"><br><br>
이메일 : <br>
<input type="email" size = "30" name="userMAIL"><br><br>
<hr>
<input type="reset" value=" ◀ 다시작성 ">
<input type="submit" value=" 가입하기 ▶ ">
<hr><hr>
</fieldset>
</form>
</body>
</html>
An error was found in the validation step that prevented validation from being performed properly.
onsubmit=”return false” works fine. Perhaps it is a connection problem. Why can’t I connect?
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ include file = "dbConn.jsp" %>
<%
String u_id = request.getParameter("userID");
String u_pw = request.getParameter("userPW");
String u_mail = request.getParameter("userMAIL");
String sql="INSERT INTO members(id, passwd, email) VALUES";
sql += "('" + u_id + "','" + u_pw + "','" + u_mail +"')";
Statement sm = conn.createStatement();
int count = sm.executeUpdate(sql);
if(count ==1){
response.sendRedirect("signupSuccess.jsp");
}else{
out.println("회원가입 실패!");
response.sendRedirect("signup.jsp");
}
sm.close();
conn.close();
%>
This is the contents of insertDB. I’m attaching it in case there might be a cause here.
If there is no problem with the code, is the external factor the problem? I am wondering what steps to take to solve this.