📄 register_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public final class Register_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
out.write('\n');
out.write('\n');
out.write('\n');
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n");
out.write(" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
out.write("\n");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
out.write(" <title>网上银行</title>\n");
out.write(" </head>\n");
out.write(" <body>\n");
out.write(" ");
String userName=request.getParameter("userName");; String userPassword = request.getParameter("userPassword"); String reUserPassword=request.getParameter("rePassword"); String servicePassword = request.getParameter("servicePassword"); String reServicePassword=request.getParameter("reServicePassword"); String accountID = " "+request.getParameter("accountID"); String IDcard = request.getParameter("ID"); String accountPassword = request.getParameter("accountPassword"); String address = request.getParameter("address"); String phone = request.getParameter("phone"); String mobile = request.getParameter("mobile"); String email = request.getParameter("email"); if(!userPassword.equals(reUserPassword)) { out.println("两次输入的登陆密码不一致,请重新输入");
out.write("\n");
out.write(" <p align = \"center\">\n");
out.write(" <a href = \"Register.html\">回到注册界面</a>\n");
out.write(" ");
} else if(!servicePassword.equals(reServicePassword)) { out.println("两次输入的服务密码不一致,请重新输入");
out.write("\n");
out.write(" <p align = \"center\">\n");
out.write(" <a href = \"Register.html\">回到注册界面</a>\n");
out.write(" ");
} else { String dbUrl = "jdbc:odbc:afei"; String user = "scott"; String password = "tiger"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection(dbUrl,user,password); // String sql = "Select * from deAccount where accountID = '"+accountID+"'"; and IDcard = '"+IDcard+"'"; Statement stat = conn.createStatement(); ResultSet result = stat.executeQuery(sql); if(!result.next()) { out.println("对不起,您输入的帐号不存在! 请重新输入");
out.write("\n");
out.write(" <meta http-equiv=\"refresh\" content=\"2; URL=Register.html\">\n");
out.write(" ");
} else { String sql1 = "Select * from deAccount where accountID = '"+accountID+"' and IDcard = '"+IDcard+"'"; ResultSet result1 = stat.executeQuery(sql1); if(!result1.next()) { out.println("对不起,您输入的帐号和身份证号不匹配! 请重新输入");
out.write("\n");
out.write(" <meta http-equiv=\"refresh\" content=\"2; URL=Register.html\">\n");
out.write(" ");
} else { String sql2 = "Select * from deAccount where accountID = '"+accountID+"' and IDcard = '"+IDcard+"' and accountPassword='"+accountPassword+"'"; ResultSet result2 = stat.executeQuery(sql2); if(!result2.next()) { out.println("对不起,您输入的密码错误! 请重新输入");
out.write("\n");
out.write(" <meta http-equiv=\"refresh\" content=\"2; URL=Register.html\">\n");
out.write(" ");
} else { CallableStatement proc = conn.prepareCall("{ call InsertNetMember(?,?,?,?,?,?,?,?) }"); proc.setString(1, userName); proc.setString(2, userPassword); proc.setString(3,servicePassword); proc.setString(4, accountID); proc.setString(5, IDcard); proc.setString(6,phone); proc.setString(7, mobile); proc.setString(8, email); proc.execute(); proc.close(); conn.close(); } } } } catch(Exception connectException) { out.println(connectException); out.println("连接数据库失败,请联系管理员!"); }
out.write("\n");
out.write(" <p align = \"center\">\n");
out.write(" 祝贺您注册成功\n");
out.write(" <meta http-equiv=\"refresh\" content=\"2; URL=Login.html\">\n");
out.write(" ");
}
out.write("\n");
out.write(" \n");
out.write(" \n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -