blog似乎有点问题,上一片"spring MVC 实战(一)"好像由于篇幅过长,老是出现404问题.没办法,只好把剩余的代码在这里补上  :(

View:

 注册页面 regist.jsp

xml 代码
  1. <DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">     
  2.      
  3. <html>     
  4.     <head>     
  5.         <meta http-equiv="Content-Type" content="text/html;      
  6.  charset=GBK">     
  7.         <title>Regist Pagetitle>     
  8.     head>     
  9.     <body>     
  10.         <FORM name="myForm" action="/MySpring/regist.do"       
  11.                       onSubmit="return check()" method="post">     
  12.             <br>     
  13.              用户名:      
  14.             <input type="text" name="username" size="20">     
  15.             <br>     
  16.              密 码 :      
  17.                   
  18.             <input type="password" name="password" size="20"><br>     
  19.              姓 名 :       
  20.             <input type="text" name="name" size="20"><br>     
  21.             <p>     
  22.                 <input type="submit" value="提交" name="submitButton">     
  23.                 <input type="reset" value="重置" name="resetButton">     
  24.         FORM>     
  25.         <script language="javascript">...      
  26.         function check()...{      
  27.          if(!document.myForm.username.value)...{      
  28.          alert("请输入用户名!")      
  29.          return false      
  30.          }      
  31.          if(!document.myForm.password.value)...{      
  32.          alert("请输入密码")      
  33.          return false      
  34.          }      
  35.          if(!document.myForm.name.value)...{      
  36.          alert("请输入姓名")      
  37.          return false      
  38.          }      
  39.          else      
  40.             return true      
  41.         }      
  42.        </script>     
  43.     </body>     
  44. </html>     

 


注册结果:

success.jsp

java 代码
  1.   
  2. <html>   
  3. <head>   
  4. <meta http-equiv="Content-Type" content="text/html; charset=GBK">   
  5. <title>Success Viewtitle>   
  6. head>   
  7. <body>   
  8.     Welcome!!   
  9.     ${student.username}   
  10. </body>   
  11. </html>  


fail.jsp

java 代码
  1. <html>   
  2. <head>   
  3. <meta http-equiv="Content-Type" content="text/html; charset=GBK">   
  4. <title>Fail Viewtitle>   
  5. head>   
  6. <body>   
  7. Sorry!!   
  8. The username ${student.username} has been registed!!   
  9. body>   
  10. html>  



评论
发表评论

您还没有登录,请登录后发表评论

domain
搜索本博客
最近加入圈子
存档
最新评论
评论排行榜