Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java EE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 strut不能跳转,高手指点!
wanggang





发贴: 2
积分: 0
于 2007-09-29 14:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
高手们指导一下 小人刚学Strut
我的web页面 login.jsp 里的form
<form name="loginForm" action="login.do" method="post">
<table align="center">
<tr>
<td>用户编号</td>
<td>
<input type="text" name="userName"/>
</td>
</tr>
<tr>
<td>密码</td>
<td>
<input type="password" name="userPwd"/>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="Submit" value="登陆">
  
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>

strut-config.xml里action影射如下:

<action
attribute="loginForm"
input="/login.jsp"
name="loginForm"
path="/login"
scope="request"
type="com.wang.struts.action.LoginAction"
validate="true">
<forward name="success" path="/success.jsp"/>
<forward name="failed" path="/failure.jsp"/>
</action>

可是不能跳转啊。点登陆以后还停留在原来页面上 不过地址成了 login.do

高手指点。



作者 Re:strut不能跳转,高手指点! [Re:wanggang]
wanggang





发贴: 2
积分: 0
于 2007-09-29 14:39 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list



作者 Re:strut不能跳转,高手指点! [Re:wanggang]
q_c114





发贴: 11
积分: 0
于 2007-10-03 13:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你页面表单里面的action应该和strut-config.xml里面的path值一致!

<form name="loginForm" action="login.do" method="post">
应该写成
<form name="loginForm" action="/login" method="post">
至于加不加*.do其实无所谓的,IDE会自动识别的!



作者 Re:strut不能跳转,高手指点! [Re:wanggang]
aroky1983





发贴: 20
积分: 0
于 2007-10-10 20:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
/login.do


作者 Re:strut不能跳转,高手指点! [Re:wanggang]
wxpsjm





发贴: 4
积分: 0
于 2007-10-28 14:33 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
页面里面:
<form name="loginForm" *action="login.do" (action="/login") method="post">
你的配置:
<action
attribute="loginForm"
input="/login.jsp"
name="loginForm"
*path="/login" <!-- 和这里的一致(3楼说的对)-->
scope="request"
type="com.wang.struts.action.LoginAction"
validate="true">
<forward name="success" path="/success.jsp"/>
<forward name="failed" path="/failure.jsp"/>
</action>

还有用表单提交 可以不用学*.do 但是。。如果是通过超连接提交到action一定要写.do




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923