<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
 

<% request.setCharacterEncoding("utf-8");%>

<% 
   String id = request.getParameter("id")==null?"":request.getParameter("id");
   String passwd= request.getParameter("password")==null?"":request.getParameter("password");
   String name = request.getParameter("name")==null?"":request.getParameter("name");   
   String post = request.getParameter("post")==null?"":request.getParameter("post");   
   String str="";
   
   try{
	 
	   Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20182244","990621");
		PreparedStatement pstmt=conn.prepareStatement("insert into MEMBER_2A(id,password,name,post) values(?,?,?,?)");
		pstmt.setString(1, id);
		pstmt.setString(2, passwd);
		pstmt.setString(3, name);
		pstmt.setString(4, post);
		
		pstmt.executeUpdate();
		pstmt.close();
		conn.close();  
	 	 
		
		
 	 str= "회원가입에 성공하였습니다.";
 	}catch(Exception e){ 
 		e.printStackTrace();
 		str="회원가입에 실패하셨습니다.";
response.sendRedirect("loginForm.jsp");
 	}
 %>
<html>
<head>
<title>회원가입</title>
</head>
<body>
  <%=str %>  <p>
 
 <A href="http://localhost:8080/member12/abc/main.jsp">메인으로</A>
  
</body>
</html>