⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 signup.jsp

📁 一个注册系统的源代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" %><%@ page errorPage="errorpage.jsp?from=signup.jsp" %><jsp:useBean id="signinchk" scope="page" class="signup.SignIn" /><jsp:useBean id="CONST" scope="session" class="signup.BeansConstants" /><jsp:useBean id="PROF" scope="page" class="signup.Profile" /><jsp:setProperty name="PROF" property="*" /><%@ include file="head.html"%><%///////////////////////////////////////////www.bqlr.com //////////////////////////真正开始String userid=request.getParameter("userid");String password=request.getParameter("password");if (request.getParameter("add")!=null){	if (!PROF.isValid()){           out.println("some of the form entrys whith '*' not completed");	       return;	}	if (PROF.EmailExist()){	%>    <jsp:include page="error.jsp?error_info=email已经存在 请重新调换一个!" flush="true"/>    <%	  return;	}    int rs=PROF.insert();    %><center><br><br><br>注册成功!<br>可以输入用户名和密码发言.   <br>	<input class="button" type="button"  value="关闭本窗口" onclick="Javascript:window.close();">	<br><br></center>	<%}else if (request.getParameter("edit")!=null){    if  (!signinchk.SignIn(userid,password))    {          out.println("No login");          return;    }    PROF.update();    %><center><br><br><br>注册资料修改成功!</p>	 <br>	<input class="button" type="button"  value="关闭本窗口" onclick="Javascript:window.close();">	<br><br></center>	<%}else{%><script><!--function validate(field) {   var valid = "_-0123456789";   var ok = "yes";   var temp;   for (var i=0; i<field.value.length; i++) {       temp = "" + field.value.substring(i, i+1);       if (valid.indexOf(temp) == "-1")	      ok = "no";   }   if (ok == "no") {       alert(" 必须输入数字!");       field.focus();       field.select();   }}function Juge(theForm){   var myRegExp = /\w+\@[.\w]+/;   if (!myRegExp.test(theForm.email.value)) {		alert("请输入正确的Email");		theForm.email.focus();		return false;	}  if (theForm.username.value == "")  {     alert("请输入姓名!");     theForm.username.focus();     return (false);  }   if (theForm.homephone.value == "")  {     alert("请输入联系电话!");     theForm.homephone.focus();     return (false);   }   if (theForm.cardnumber.value == "")   {     alert("请输入身份证号!");     theForm.cardnumber.focus();     return (false);   }  if (theForm.year.value >2000 || theForm.year.value < 1900)   {     alert("请输入正确的年份!");     theForm.year.focus();     return (false);   }   if (theForm.month.value >12 || theForm.month.value < 1)   {     alert("请输入正确的月份");     theForm.month.focus();     return (false);   }    if (theForm.day.value > 31 || theForm.day.value < 1)   {     alert("请输入正确的日期");     theForm.day.focus();     return (false);   }}--></script><form action="signup.jsp" name=Form1 method=post onsubmit="return Juge(this);">	<table width="100%" cellspacing=0 cellpadding=0 border=0>        <table width="100%" cellpadding=2 cellspacing=2 border=0 bgcolor=#ffffff ><%/////////////////////////////////////////////////////////////////////////////////    PROF.setUserid(userid);    if (PROF.select()){	   %>  <tr><td> <P align="right">用户名</P></TD><td></td></tr>	<input class="button" type="hidden" name="userid" value="<%=userid%>">	<input class="button" type="hidden" name="password" value="<%=password%>">	<%=userid%>	   <input class="button" type="hidden" name="edit" value="1">	   <%	}else{	   %><tr><td  >   <P align="right">用户名</P></TD><td>	<input class="button" name="userid" value="" size=10></td></tr><tr><td  >   <P align="right">密码:</P></TD><td>	<input class="button"  name="password" type="password" value="" size=10></td></tr>       <input class="button" type="hidden" name="regip" value=">">	   <input class="button" type="hidden" name="passwdtype" value="">	   <input class="button" type="hidden" name="passwdanswer" value="">	   <input class="button" type="hidden" name="add" value="1">	   <%	}/////////////////////////////////////////////////////////////////////////////////%>    </td></tr>    <TR>      <TD>&nbsp; </TD>      <TD>&nbsp; </TD>    </TR>    <TR bordercolor="#FFFFFF" bgcolor="#CCCCCC">      <TD colspan="2">        <div align="center"><font color="#000000">个人资料</font> </div>      </TD>    </TR>    <TR>      <TD>        <P align="right">姓名</P>      </TD>      <TD>        <input class="button" name="username" value="<%=PROF.getUsername()%>">*      </TD>    </TR>    <TR>      <TD>        <P align="right">Email</P>      </TD>      <TD>        <input class="button" name="email" value="<%=PROF.getEmail()%>">*      </TD>    </TR>    <TR>      <TD>        <P align="right">性别</P>      </TD>      <TD>	  <%	  if (PROF.getGender()==1)	  {	     %>		 <input class="button" type="radio" value="1" name="gender" checked>男		 <input class="button" type="radio" value="0" name="gender" >女 *		 <%	  }else if (PROF.getGender()==0){         %>		 <input class="button" type="radio" value="1" name="gender" >男		<input class="button" type="radio" value="0" name="gender" checked>女 *		<%	  }else{	    %>		 <input class="button" type="radio" value="1" name="gender" >男	     <input class="button" type="radio" value="0" name="gender">女 *	    <%	  }%>	  </TD>    </TR>   <TR>      <TD>        <div align="right">职业</div>      </TD>      <TD><SELECT name="occupation">      <%       for (int i = 0; i < CONST.occupations.length; i++)       {             String occupation=CONST.toChinese((String)CONST.occupations[i]);			 if (i==PROF.getOccupation())                out.println("<OPTION value="+i+" selected>"+occupation+"</OPTION>");			 else                out.println("<OPTION value="+i+">"+occupation+"</OPTION>");       }      %>      </SELECT> </TD>    </TR>  <TR>      <TD>        <P align="right">住址</P>      </TD>      <TD>        <input class="button" maxLength="150" name="location" size="40" value="<%=PROF.getLocation()%>">      </TD>    </TR>    <TR>      <TD>        <div align="right">城市</div>      </TD>      <TD>        <input class="button" type="text" name="city" value="<%=PROF.getCity()%>">      </TD>    </TR>   <TR>      <TD>        <div align="right">省份</div>      </TD>      <TD><SELECT name="country">       <%       for (int i = 0; i < CONST.countrys.length; i++)       {           String country =CONST.toChinese((String)CONST.countrys[i]);           if (i==PROF.getCountry())                out.println("<OPTION value="+i+" selected>"+country +"</OPTION>");		   else                out.println("<OPTION value="+i+">"+country +"</OPTION>");       }      %>      </SELECT>*      </TD>    </TR>    <TR>      <TD>        <div align="right"> 邮政编码</div>      </TD>      <TD>        <input class="button" name="zipcode" value="<%=PROF.getZipcode()%>" onBlur="validate(this)">      </TD>    </TR>    <TR>      <TD>        <div align="right">电话</div>      </TD>      <TD>        <input class="button" type="text" name="homephone" value="<%=PROF.getHomephone()%>" onBlur="validate(this)">      </TD>    </TR>    <TR>      <TD>        <div align="right">身份证号</div>      </TD>      <TD>        <input class="button" type="text" name="cardnumber"  value="<%=PROF.getCardnumber()%>" onBlur="validate(this)">*      </TD>    </TR>    <TR>      <TD>        <div align="right">出生日期</div>      </TD>      <TD>        <input class="button" maxLength="4" size="4" value="<%=PROF.getYear()%>" name="year" onBlur="validate(this)">        <input class="button" maxLength="2" size="2" value="<%=PROF.getMonth()%>" name="month" onBlur="validate(this)">        <input class="button" maxLength="2" size="2" value="<%=PROF.getDay()%>" name="day" onBlur="validate(this)">        日 *</TD>    </TR>    <TR>      <TD>&nbsp; </TD>      <TD><input class="button" type="submit" style='color: 000000; background-color:ededaf'  value="确定">  <input class="button" type="Reset" style='color: 000000; background-color:ededaf'  value="复位"></TD>    </TR>    <TR>      <TD>&nbsp; </TD>      <TD>&nbsp; </TD>    </TR>  </TABLE>  </td></tr></table>      </form><%}%><%@ include file="end.html"%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -