日期:2014-05-20  浏览次数:20665 次

struts2跳转问题
myeclipse8.5 登录界面login.html放在了webRoot下,提交表单,进入 com.test.action.user包下得loginAction,成功后如何跳转到web-inf下的content下得 user下得a.html 谢谢!
最好能讲下为什么..

------解决方案--------------------
struts配置文件里配呗
------解决方案--------------------
为什么跳转到web-inf目录下?跳转直接在配置文件的result里写路径就可以了。
------解决方案--------------------
login.html 不能和要跳转的页面 放到一个目录下么?
------解决方案--------------------
action中方法return的字符串与struts.xml中result的name对应:

action中:
return "ok"

struts中:
<result name="ok">/xxx.jsp</result>
xxx为你指定的路径包括包名与文件名.
------解决方案--------------------
友情帮顶,好像不可以吧,一般放在WEB-INF的文件,我一般也就是用velocity模板读取的,没有跳转过
------解决方案--------------------
为什么要跳转到Web-inf下,web-inf下一般是放配置文件的,webroot才根目录,既然是jsp那么所有的页面就应该是webroot下啊。
------解决方案--------------------
struts.xml里
XML code

<action name="login" class="com.test.action.user.loginAction">
    <result name="success">/WEB-INF/content/user/a.html</result>
</action>

------解决方案--------------------
探讨

为什么要跳转到Web-inf下,web-inf下一般是放配置文件的,webroot才根目录,既然是jsp那么所有的页面就应该是webroot下啊。