<%@ page language="java" import="java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<body>
<%
request.setCharacterEncoding("utf-8");
String users=request.getParameter("username");
String pass=request.getParameter("pwd");
%>
<%
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://127.0.0.1:3306/users";
String use = "root";
String password = "5201314";
Class.forName(driver);
Connection conn= DriverManager.getConnection(url,use,password);
PreparedStatement sql =conn.prepareStatement("insert into zm(id,pass)values(?,?)");
sql.setString(1,users);
sql.setString(2,pass);
int rtn=sql.executeUpdate();
sql.close();
conn.close();
%>
<%
if(rtn==1){%><jsp:forward page="enroll_success.jsp"/><%}
else{%><jsp:forward page="enroll_fail.jsp"/><%}
%>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<body>
<%
request.setCharacterEncoding("utf-8");
String users=request.getParameter("username");
String pass=request.getParameter("pwd");
%>
<%
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://127.0.0.1:3306/users";
String use = "root";
String password = "5201314";
Class.forName(driver);
Connection conn= DriverManager.getConnection(url,use,password);
PreparedStatement sql =conn.prepareStatement("insert into zm(id,pass)values(?,?)");
sql.setString(1,users);
sql.setString(2,pass);
int rtn=sql.executeUpdate();
sql.close();
conn.close();
%>
<%
if(rtn==1){%><jsp:forward page="enroll_success.jsp"/><%}
else{%><jsp:forward page="enroll_fail.jsp"/><%}
%>
</body>
</html>