joinProcess.jsp
페이지 정보

본문
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%
request.setCharacterEncoding("UTF-8");
String id=request.getParameter("id");
String pass=request.getParameter("pass");
String name=request.getParameter("name");
int age=Integer.parseInt(request.getParameter("age"));
String gender=request.getParameter("gender");
String email=request.getParameter("email");
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/test?serverTimezone=UTC";
String user="root";
String password="1111";
Connection conn=null;
PreparedStatement pstmt=null;
try {
conn=DriverManager.getConnection(url, user, password);
pstmt=conn.prepareStatement("INSERT INTO member2 VALUES (?,?,?,?,?,?)");
pstmt.setString(1,id);
pstmt.setString(2,pass);
pstmt.setString(3,name);
pstmt.setInt(4,age);
pstmt.setString(5,gender);
pstmt.setString(6,email);
int result = pstmt.executeUpdate();
if(result!=0){
out.println("<script>");
out.println("location.href='loginForm.jsp'");
out.println("</script>");
}else{
out.println("<script>");
out.println("location.href='joinForm.jsp'");
out.println("</script>");
}
}catch(Exception e){
e.printStackTrace();
}finally{
try{
pstmt.close();
conn.close();
}
catch(Exception e){
e.printStackTrace();
}
}
%>
- 이전글joinForm.jsp 21.07.15
- 다음글loginProcess.jsp 21.07.15
댓글목록
등록된 댓글이 없습니다.
