下面是2.5.2的版本
<filter>
<filter-name></filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
<filter>
3、关于使用通配符调用无效的问题新学习的同学按照一些视频上,原来2.3的样子写出代码来,在运行的时候会报错,错误如下。
Struts Problem Report
Struts has detected an unhandled exception:
Messages: There is no Action mapped for namespace [/actions] and action name [Studentadd] associated with context path [].
原来在struts2.5 中为了增加安全性,在 struts.xml 添加了这么个属性:添加完成之后就可以正常运行通配符的配置了。
<package name="default" extends="struts-default">
<global-allowed-methods>regex:.*</global-allowed-methods>
<action name="Student*" class="com.action.method.dmi.StudentAction" method="{1}">
<result>/Student{1}_success.jsp</result>
</action>
<action name="*_*_success" class="com.action.method.dmi.{1}Action" method="{2}">
<result>/{1}_{2}_success.jsp</result>
</action>
</package>