joinProcess.jsp > MODEL

본문 바로가기
사이트 내 전체검색

MODEL

joinProcess.jsp

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 1,612회 작성일 21-07-15 19:42

본문

<%@ 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();

  }

  }

%>

추천0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

공지사항
자유게시판
질문답변
1:1문의

 

별명 : 터푸가위
주소 : 부산시 동래구 명장로20번길 90
대표 : 박규태
메일 : dancepkt@******.com

접속자집계

오늘
770
어제
1,064
최대
10,760
전체
498,799
Copyright © dancePKT . All rights reserved.