替换jar
javassist-3.20.0-GA.jar commons-beanutils-1.9.4.jar commons-fileupload-1.4.jar commons-io-2.6.jar commons-lang3-3.8.1.jar freemarker-2.3.30.jar log4j-1.2.17.jar log4j-api-2.12.1.jar ognl-3.1.28.jar struts2-core-2.5.26.jar struts2-spring-plugin-2.5.26.jar |
删除jar
xwork-core-2.3.x.jar |
修改web.xml
修改前:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
去掉ng,修改后:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
修改struts.xml
文件头:
修改前: <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> 修改后: <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> |
文件内容:
<struts> <!-- 让struts2支持动态方法调用 --> <constant name="struts.enable.DynamicMethodInvocation" value="true"/> <constant name="struts.enable.SlashesInActionNames" value="true"/> <!-- 所有匹配*.action的请求都由struts2处理 --> <constant name="struts.action.extension" value="action" /> <package name="default" extends="struts-default" strict-method-invocation="false"> <!-- 放在action之前 --> <global-allowed-methods>regex:.*</global-allowed-methods> <action ... ></action> ... </package> </struts> |