2006-09-19
spring MVC 实战(一) [续]
blog似乎有点问题,上一片"spring MVC 实战(一)"好像由于篇幅过长,老是出现404问题.没办法,只好把剩余的代码在这里补上 :(
View:
View:
注册页面 regist.jsp
xml 代码
- <DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;
- charset=GBK">
- <title>Regist Pagetitle>
- head>
- <body>
- <FORM name="myForm" action="/MySpring/regist.do"
- onSubmit="return check()" method="post">
- <br>
- 用户名:
- <input type="text" name="username" size="20">
- <br>
- 密 码 :
- <input type="password" name="password" size="20"><br>
- 姓 名 :
- <input type="text" name="name" size="20"><br>
- <p>
- <input type="submit" value="提交" name="submitButton">
- <input type="reset" value="重置" name="resetButton">
- FORM>
- <script language="javascript">...
- function check()...{
- if(!document.myForm.username.value)...{
- alert("请输入用户名!")
- return false
- }
- if(!document.myForm.password.value)...{
- alert("请输入密码")
- return false
- }
- if(!document.myForm.name.value)...{
- alert("请输入姓名")
- return false
- }
- else
- return true
- }
- </script>
- </body>
- </html>
注册结果:
success.jsp
java 代码
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=GBK">
- <title>Success Viewtitle>
- head>
- <body>
- Welcome!!
- ${student.username}
- </body>
- </html>
fail.jsp
java 代码
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=GBK">
- <title>Fail Viewtitle>
- head>
- <body>
- Sorry!!
- The username ${student.username} has been registed!!
- body>
- html>
发表评论
- 浏览: 6016 次
- 性别:

- 来自: 陕西

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
五十音图
写 东西 认真点才有人看
-- by Uranus -
Spring 实战(二) aop
代码看点有点眼花,建议放在java代码格式内
-- by tiger.passion






评论排行榜