`
lostmemorise
  • 浏览: 3805 次
  • 性别: Icon_minigender_1
  • 来自: 安阳
社区版块
存档分类
最新评论

struts2 welcome-file-list 设置的路径不能是Action地址

 
阅读更多
<welcome-file-list>中配置Struts2 的action是不能被访问的,但是Struts1的行原理在于:
在tomcat中配置的 <welcom-file> 是基于servlet 的struts2 的运行机制却是filter。


解决办法,设置index.jsp等,在这个里面通过url跳转或struts2的action标签跳转到你的action的地址就可以了,

web.xml中这样配置
<welcome-file-list> 
  <welcome-file>index.jsp</welcome-file> 
</welcome-file-list>


然后在index.jsp中使用Struts2的标签
<s:action name="getDataInfo" executeResult="true"></s:action>


这个标签会执行这个action,然后返回结果页面.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics