Struts2.3升级到Struts2.5.20版本问题汇总
Struts2.3升级到Struts2.5.20版本问题汇总
1.整理需要升级的包
下载地址:链接:https://pan.baidu.com/s/1OPDxgR793mKOH7TR2rfMcg 提取码:1peq
commons-lang-2.4.jar,commons-lang3-3.8.1.jar,javassist-3.20.0-GA.jar,log4j-1.2-api-2.7.jar,log4j-api-2.7.jar,log4j-core-2.7.jar,struts2-core-2.5.20.jar,struts2-spring-plugin-2.5.20.jar,common.jar
其中common.jar是自定义的包。是已经修改好的。如果想要自行修改可以使用反编译工具反编译StrutsFilter.class文件。主要是替换引入的Struts的包名。又原来的org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;
换成最新的Struts2.5.20的
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter;
如果需要其他Struts的最新包可以去下载:https://struts.apache.org/download.cgi#struts2520
记得下载struts-2.5.20-all.zip版本,这里全部是Struts2.5.20关联的包
2.修改所有的struts*.xml匹配的文件。主要修改内容如下
如果什么都不做点击方法报错:
com.opensymphony.xwork2.config.ConfigurationException: Method listAllUser for action user is not allowed!
如果不做第一步,而做了第二步:
org.xml.sax.SAXParseException: Attribute "strict-method-invocation" must be declared for element type "package".
如果不做第二步:
com.opensymphony.xwork2.config.ConfigurationException: Method listRole for action role is not allowed!
=====================================================================
博客地址:https://www.codepeople.cn
=====================================================================
微信公众号: