reg.jsp
上传用户:tanyanyong
上传日期:2013-06-23
资源大小:1355k
文件大小:4k
源码类别:

电子政务应用

开发平台:

MultiPlatform

  1. <%@ page session="true" %>
  2. <jsp:useBean id="user" scope="page" class="bookshop.run.op_user" />
  3. <%
  4. String mesg = "";
  5. String submit = request.getParameter("Submit");
  6. if (submit!=null && !submit.equals("")) {
  7. if(user.add(request)){
  8. session.setAttribute("username",user.getUserName());
  9. session.setAttribute( "userid", Long.toString( user.getUserid() ) ); 
  10. response.sendRedirect("info.jsp?action=regok");
  11. } else if (!user.getMessage().equals("")) {
  12. mesg = user.getMessage();
  13. } else
  14. mesg = "注册时出现错误,请稍后再试";
  15. }
  16. %>
  17. <script language="javascript">
  18. function openScript(url,name, width, height){
  19. var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
  20. }
  21. function checkform() {
  22. if (document.form1.username.value==""){
  23. alert("用户名不能为空");
  24. document.form1.username.focus();
  25. return false;
  26. }
  27. if (document.form1.passwd.value==""){
  28. alert("用户密码不能为空");
  29. document.form1.passwd.focus();
  30. return false;
  31. }
  32. if (document.form1.passwd.value!=document.form1.passconfirm.value){
  33. alert("确认密码不相符!");
  34. document.form1.passconfirm.focus();
  35. return false;
  36. }
  37. return true;
  38. }
  39. </script>
  40. <%@include file="/bookshop/inc/head.inc"%>
  41. <form name="form1" method="post" action="reg.jsp">
  42.   <%if (!mesg.equals("")) out.println("<p><font color=#ff0000>"+ mesg + "</font></p>");%>
  43.     <table width="450" border="0" cellspacing="1" cellpadding="1" align=center>
  44.  <tr></tr>
  45.       <tr> 
  46.         <td colspan="2" align="center"><b><font color="#0000FF">用户注册</font></b></td>
  47.       </tr>
  48.      <tr></tr>
  49.       <tr> 
  50.         <td width="171" align="right">用户名:</td>
  51.         <td width="272"> 
  52.           <input type="text" name="username" maxlength="20" size="14" >
  53.         </td>
  54.       </tr>
  55.       <tr> 
  56.         <td width="171" align="right">密码:</td>
  57.         <td width="272">
  58.           <input type="password" name="passwd" maxlength="20" size="14">
  59.         </td>
  60.       </tr>
  61.       <tr> 
  62.         <td width="171" align="right">确认密码:</td>
  63.         <td width="272">
  64.           <input type="password" name="passconfirm" maxlength="20" size="14">
  65.         </td>
  66.       </tr>
  67.       <tr> 
  68.         <td width="171" align="right">真实姓名:</td>
  69.         <td width="272">
  70.           <input type="text" name="names" maxlength="20" size="14">
  71.         </td>
  72.       </tr>
  73.       <tr> 
  74.         <td width="171" align="right">性别:</td>
  75.         <td width="272">
  76.           <select name="sex">
  77.             <option>男</option>
  78.             <option>女</option>
  79.           </select>
  80.         </td>
  81.       </tr>
  82.       <tr> 
  83.         <td width="171" align="right">联系地址:</td>
  84.         <td width="272">
  85.           <input type="text" name="address" maxlength="150" size="40">
  86.         </td>
  87.       </tr>
  88.   <tr> 
  89.         <td width="171" align="right">联系邮编:</td>
  90.         <td width="272">
  91.           <input type="text" name="post" maxlength="8" size="8">
  92.         </td>
  93.       </tr>
  94.       <tr> 
  95.         <td width="171" align="right">联系电话:</td>
  96.         <td width="272">
  97.           <input type="text" name="phone" maxlength="25" size="16">
  98.         </td>
  99.       </tr>
  100.       <tr> 
  101.         <td width="171" align="right">电子邮件:</td>
  102.         <td width="272">
  103.           <input type="text" name="email" maxlength="50" size="25">
  104.         </td>
  105.       </tr>
  106.       <tr>
  107.         <td width="171" align="right">&nbsp; </td>
  108.         <td width="272">
  109.           <input type="submit" name="Submit" value="注册" onclick="javascript:return(checkform());">
  110.           <input type="reset" name="reset" value="取消">
  111.         </td>
  112.       </tr>
  113.     </table>  
  114.   </form>
  115.  
  116. <%@include file="/bookshop/inc/tail.inc"%> 
  117.