<welcome-file-list>中配置Struts2 的action是不能被访问的,但是Struts1的行原理在于:
在tomcat中配置的 <welcom-file> 是基于servlet 的struts2 的运行机制却是filter。
解决办法,设置index.jsp等,在这个里面通过url跳转或struts2的action标签跳转到你的action的地址就可以了,
web.xml中这样配置
然后在index.jsp中使用Struts2的标签
这个标签会执行这个action,然后返回结果页面.
在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,然后返回结果页面.