📄 _0002fregistration_0002ejspregistration_jsp_0.java
字号:
String sRegistrationErr = "";
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(21,2);to=(31,0)]
out.write("\r\n<html>\r\n<head>\r\n<title>用户注册</title>\r\n<meta http-equiv=\"pragma\" content=\"no-cache\"/>\r\n<meta http-equiv=\"expires\" content=\"0\"/>\r\n<meta http-equiv=\"cache-control\" content=\"no-cache\"/>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n</head>\r\n<body bgcolor=\"#CDCEDC\" text=\"#000000\" link=\"#000080\" vlink=\"#000080\" alink=\"#000080\">\r\n"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(31,0);to=(31,45)]
{
String _jspx_qStr = "";
pageContext.include("Header.jsp" + _jspx_qStr);
}
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(31,45);to=(32,0)]
out.write("\r\n"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(32,0);to=(32,64)]
jspreg.dbBean dBBean = null;
boolean _jspx_specialdBBean = false;
synchronized (request) {
dBBean= (jspreg.dbBean)
pageContext.getAttribute("dBBean",PageContext.REQUEST_SCOPE);
if ( dBBean == null ) {
_jspx_specialdBBean = true;
try {
dBBean = (jspreg.dbBean) Beans.instantiate(this.getClass().getClassLoader(), "jspreg.dbBean");
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"jspreg.dbBean");
}
pageContext.setAttribute("dBBean", dBBean, PageContext.REQUEST_SCOPE);
}
}
if(_jspx_specialdBBean == true) {
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(31,45);to=(32,0)]
out.write("\r\n"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(32,0);to=(32,64)]
}
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(33,14);to=(34,0)]
out.write("\r\n"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(34,2);to=(102,0)]
dBBean.connect();
String method=request.getMethod().trim();
if(method.toLowerCase().equals("post")){
flduser_login = getParam(request, "user_login");
flduser_password = getParam(request, "user_password");
flduser_password2 = getParam(request, "user_password2");
fldname = getParam(request, "name");
fldname=new String((fldname.getBytes("iso8859-1"))) ;
fldemail = getParam(request, "email");
fldaddress = getParam(request, "address");
fldaddress=new String((fldaddress.getBytes("iso8859-1"))) ;
fldcity = getParam(request, "city");
fldcity=new String((fldcity.getBytes("iso8859-1"))) ;
fldstate_id = getParam(request, "state_id");
fldzip = getParam(request, "zip");
fldage = getParam(request, "age");
fldgender = getParam(request, "gender");
fldeducation = getParam(request, "education");
fldincome = getParam(request, "income");
fldnotes = getParam(request, "notes");
fldnotes=new String((fldnotes.getBytes("iso8859-1"))) ;
if ( isEmpty(flduser_login) ) {
sRegistrationErr += "请填写用户名*<br>";
}
if ( isEmpty(flduser_password) ) {
sRegistrationErr += "请填写用户口令*<br>";
}
if ( !flduser_password.equals(flduser_password2)) {
sRegistrationErr += "填写的口令不相符<br>";
}
if ( ! isEmpty(flduser_login)) {
java.sql.ResultSet rs=dBBean.openRs("select * from users where user_login='"+flduser_login+"'");
if(rs.next())
sRegistrationErr += "你填写的用户名已经被人使用*<br>";
}
if(sRegistrationErr.trim().equals("")){
String sSQL = "insert into users (" +
"user_login," +
"user_password," +
"name," +
"email," +
"address," +
"city," +
"state_id," +
"zip," +
"age," +
"gender," +
"education," +
"income," +
"notes)" +
" values (" +
toSQL(flduser_login, adText) + "," +
toSQL(flduser_password, adText) + "," +
toSQL(fldname, adText) + "," +
toSQL(fldemail, adText) + "," +
toSQL(fldaddress, adText) + "," +
toSQL(fldcity, adText) + "," +
toSQL(fldstate_id, adText) + "," +
toSQL(fldzip, adText) + "," +
toSQL(fldage, adNumber) + "," +
toSQL(fldgender, adNumber) + "," +
toSQL(fldeducation, adNumber) + "," +
toSQL(fldincome, adNumber) + "," +
toSQL(fldnotes, adText) + ")";
dBBean.executeSql(sSQL);
}
}
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(102,2);to=(111,8)]
out.write("\r\n <table>\r\n <tr>\r\n\r\n <td valign=\"top\">\r\n <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#BCBC7A\" bordercolorlight=\"#000000\" bordercolordark=\"#FFFFFF\">\r\n <tr>\r\n <td align=\"center\" bgcolor=\"#666633\" colspan=\"2\"><font style=\"font-size: 12pt; color: #FFFFFF; font-family: Arial, Tahoma, Verdana, Helvetica; font-weight: bold\">填写注册信息</font></td>\r\n </tr>\r\n "); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(111,10);to=(111,43)]
if(!"".equals(sRegistrationErr)){
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(111,45);to=(113,142)]
out.write("\r\n <tr>\r\n <td bgcolor=\"#DDDDBD\" colspan=\"2\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(113,145);to=(113,161)]
out.print(sRegistrationErr);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(113,163);to=(115,8)]
out.write("</font></td>\r\n </tr>\r\n "); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(115,10);to=(115,56)]
}else if(method.toLowerCase().equals("post")){
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(115,58);to=(119,8)]
out.write("\r\n <tr>\r\n <td bgcolor=\"#DDDDBD\" colspan=\"2\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">注册成功</font></td>\r\n </tr>\r\n "); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(119,10);to=(119,11)]
}
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(119,13);to=(120,8)]
out.write("\r\n "); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(120,10);to=(120,85)]
if((!"".equals(sRegistrationErr))||(!method.toLowerCase().equals("post"))){
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(120,87);to=(124,95)]
out.write("\r\n <form method=\"post\" action=\"Registration.jsp\" name=\"Registration\">\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">用户名*</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"text\" name=\"user_login\" maxlength=\"15\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(124,98);to=(124,111)]
out.print(flduser_login);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(124,113);to=(128,102)]
out.write("\" size=\"15\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">口令*</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"password\" name=\"user_password\" maxlength=\"15\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(128,105);to=(128,121)]
out.print(flduser_password);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(128,123);to=(132,103)]
out.write("\" size=\"15\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">确认口令*</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"password\" name=\"user_password2\" maxlength=\"15\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(132,106);to=(132,123)]
out.print(flduser_password2);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(132,125);to=(136,89)]
out.write("\" size=\"15\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">姓名</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"text\" name=\"name\" maxlength=\"20\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(136,92);to=(136,99)]
out.print(fldname);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(136,101);to=(140,90)]
out.write("\" size=\"20\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">Email</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"text\" name=\"email\" maxlength=\"30\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(140,93);to=(140,101)]
out.print(fldemail);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(140,103);to=(144,92)]
out.write("\" size=\"30\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">详细住址</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"text\" name=\"address\" maxlength=\"50\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(144,95);to=(144,105)]
out.print(fldaddress);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(144,107);to=(148,89)]
out.write("\" size=\"50\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">所在城市</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"text\" name=\"city\" maxlength=\"50\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(148,92);to=(148,99)]
out.print(fldcity);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(148,101);to=(152,59)]
out.write("\" size=\"50\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">省份</font></td>\r\n <td bgcolor=\"#DDDDBD\"><select name=\"state_id\">"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(152,62);to=(152,142)]
out.print(getOptions(dBBean.openRs("select * from lookup_states"),false,false,fldstate_id));
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(152,144);to=(156,87)]
out.write("</select></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">邮编</font></td>\r\n <td bgcolor=\"#DDDDBD\"><input type=\"text\" name=\"zip\" maxlength=\"10\" value=\""); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(156,90);to=(156,96)]
out.print(fldzip);
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(156,98);to=(160,54)]
out.write("\" size=\"10\"></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">年龄</font></td>\r\n <td bgcolor=\"#DDDDBD\"><select name=\"age\" >"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(160,57);to=(160,130)]
out.print(getOptions(dBBean.openRs("select * from lookup_ages"),false,false,fldage));
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(160,132);to=(164,57)]
out.write("</select></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">性别</font></td>\r\n <td bgcolor=\"#DDDDBD\"><select name=\"gender\" >"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(164,60);to=(164,139)]
out.print(getOptions(dBBean.openRs("select * from lookup_genders"),false,false,fldgender));
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(164,141);to=(168,58)]
out.write("</select></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">受教育程度</font></td>\r\n <td bgcolor=\"#DDDDBD\"><select name=\"education\">"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(168,61);to=(168,146)]
out.print(getOptions(dBBean.openRs("select * from lookup_educations"),false,false,fldeducation));
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(168,148);to=(172,56)]
out.write("</select></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">收入</font></td>\r\n <td bgcolor=\"#DDDDBD\"><select name=\"income\">"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(172,59);to=(172,138)]
out.print(getOptions(dBBean.openRs("select * from lookup_incomes"),false,false,fldincome));
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(172,140);to=(176,75)]
out.write("</select></td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#BCBC7A\"><font style=\"font-size: 10pt; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">自己的简单介绍</font></td>\r\n <td bgcolor=\"#DDDDBD\"><textarea name=\"notes\" cols=\"50\" rows=\"5\">"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(176,78);to=(176,94)]
out.print(toHTML(fldnotes));
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(176,96);to=(183,8)]
out.write("</textarea></td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Submit\" ><input type=\"reset\" value=\"重写\" ></td>\r\n </tr>\r\n </form>\r\n\r\n "); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(183,10);to=(183,11)]
}
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(183,13);to=(191,0)]
out.write("\r\n </table>\r\n <font face=arial size=2>\r\n<b>* - 表示必须填写的信息</b>\r\n</font>\r\n </td>\r\n </tr>\r\n </table>\r\n"); // end
// begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(191,2);to=(191,17)]
dBBean.close();
// end
// HTML // begin [file="D:\\JbuilderProgram\\JspReg\\RegApp\\Registration.jsp";from=(191,19);to=(194,7)]
out.write("\r\n<center><font face=\"Arial\"><small>这是一个使用JSP开发的网上用户注册的应用程序</small></font></center>\r\n</body>\r\n</html>"); // end
} catch (Exception ex) {
if (out.getBufferSize() != 0)
out.clearBuffer();
pageContext.handlePageException(ex);
} finally {
out.flush();
_jspxFactory.releasePageContext(pageContext);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -