错误提示:
原先的错误提示为,无法根据通配符 *来匹配package.namespace和action.name
解决方法:
- 把
struts.xml头文字修改为2.5版本
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd"
>
struts标签内添加常量,目的是为了打开动态方法
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
- 对应的
package标签内添加global-allowed-methods,目的是为了匹配通配符
<global-allowed-methods>regex:.*</global-allowed-methods>
- 重启服务,如果不是配置路径写错应该没问题 .
本文解决Struts框架中动态方法调用的问题,更新struts.xml文件至2.5版本,添加动态方法调用常量及通配符匹配设置,重启服务即可生效。

8308

被折叠的 条评论
为什么被折叠?



