Topic: strut不能跳转,高手指点!

  Print this page

1.strut不能跳转,高手指点! Copy to clipboard
Posted by: wanggang
Posted on: 2007-09-29 14:28

高手们指导一下 小人刚学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

高手指点。

2.Re:strut不能跳转,高手指点! [Re: wanggang] Copy to clipboard
Posted by: wanggang
Posted on: 2007-09-29 14:39


3.Re:strut不能跳转,高手指点! [Re: wanggang] Copy to clipboard
Posted by: q_c114
Posted on: 2007-10-03 13:13

你页面表单里面的action应该和strut-config.xml里面的path值一致!

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

4.Re:strut不能跳转,高手指点! [Re: wanggang] Copy to clipboard
Posted by: aroky1983
Posted on: 2007-10-10 20:28

/login.do

5.Re:strut不能跳转,高手指点! [Re: wanggang] Copy to clipboard
Posted by: wxpsjm
Posted on: 2007-10-28 14:33

页面里面:
<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


   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