将ssh项目中strust2从2.0.11升级到2.3.15.1详细步骤
一、替换jar包
将下列jar包
asm-1.5.3.jar
cglib-2.1_3.jar
commons-beanutils-1.8.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-lang-2.0.jar
commons-logging-1.1.jar
freemarker-2.3.8.jar
javassist-3.7.1.GA.jar
ognl-2.7.3.jar
struts2-core-2.0.11.1.jar
struts2-jfreechart-plugin-2.0.11.1.jar
struts2-spring-plugin-2.0.11.1.jar
xwork-core-2.0.4.jar
替换成
asm-3.3.jar
asm-commons-3.3.jar(新增)
cglib-2.2.0.jar
commons-beanutils-1.8.0.jar
commons-fileupload-1.3.jar
commons-io-2.0.1.jar
commons-lang-2.4.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
ognl-3.0.6.jar
struts2-core-2.3.15.1.jar
struts2-jasperreports-plugin-2.3.15.1.jar (新增)
struts2-jfreechart-plugin-2.3.15.1.jar
struts2-spring-plugin-2.3.15.1.jar
xwork-core-2.3.15.1.jar
二、修改配置文件
1.首先修改struts.xml,将所有struts.xml文件头修改成如下。
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
2.如果有<constant name="struts.devMode" value="false"/>配置,将value值设为false;
3.redirectAction修改点:
将所有struts.xml中的redirect-action修改为redirectAction
4.修改validators.xml声明
<!DOCTYPE validators PUBLIC
"-//ApacheStruts//XWork Validator Config 1.0//EN"
"http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">
看了很多博客上都是改成1.2的,不过我的改成1.2之后会报以下错误(下面文档里写的是1.2,如果报错请改回1.0)
Unable to load config class org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor at interceptor
Caught Exception while registering Interceptor class org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor - interceptor - jar:file:/D:/apache-tomcat-6.0.35/webapps/ipv6/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:168:127
5.修改web.xml里的Struts2核心控制器为:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
6.注释掉filter struts-cleanup
<!--
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
7.org.apache.commons.lang类包引用修改:
例如由
org.apache.commons.lang.xwork.StringUtils
换成
org.apache.commons.lang3.StringUtils
8.如果以前有xwork-conversion.properties文件,且里面有java.lang.Enum=com.opensymphony.xwork2.util.EnumTypeConverter配置,注释之,com.opensymphony.xwork2.util.EnumTypeConverter在新版本里已经不存在了
struts2.3.15.1版本全jar包地址如下:http://pan.baidu.com/s/1vPSdC
一、替换jar包
将下列jar包
asm-1.5.3.jar
cglib-2.1_3.jar
commons-beanutils-1.8.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-lang-2.0.jar
commons-logging-1.1.jar
freemarker-2.3.8.jar
javassist-3.7.1.GA.jar
ognl-2.7.3.jar
struts2-core-2.0.11.1.jar
struts2-jfreechart-plugin-2.0.11.1.jar
struts2-spring-plugin-2.0.11.1.jar
xwork-core-2.0.4.jar
替换成
asm-3.3.jar
asm-commons-3.3.jar(新增)
cglib-2.2.0.jar
commons-beanutils-1.8.0.jar
commons-fileupload-1.3.jar
commons-io-2.0.1.jar
commons-lang-2.4.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
ognl-3.0.6.jar
struts2-core-2.3.15.1.jar
struts2-jasperreports-plugin-2.3.15.1.jar (新增)
struts2-jfreechart-plugin-2.3.15.1.jar
struts2-spring-plugin-2.3.15.1.jar
xwork-core-2.3.15.1.jar
二、修改配置文件
1.首先修改struts.xml,将所有struts.xml文件头修改成如下。
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
2.如果有<constant name="struts.devMode" value="false"/>配置,将value值设为false;
3.redirectAction修改点:
将所有struts.xml中的redirect-action修改为redirectAction
4.修改validators.xml声明
<!DOCTYPE validators PUBLIC
"-//ApacheStruts//XWork Validator Config 1.0//EN"
"http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">
看了很多博客上都是改成1.2的,不过我的改成1.2之后会报以下错误(下面文档里写的是1.2,如果报错请改回1.0)
Unable to load config class org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor at interceptor
Caught Exception while registering Interceptor class org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor - interceptor - jar:file:/D:/apache-tomcat-6.0.35/webapps/ipv6/WEB-INF/lib/struts2-core-2.3.15.1.jar!/struts-default.xml:168:127
5.修改web.xml里的Struts2核心控制器为:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
6.注释掉filter struts-cleanup
<!--
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
7.org.apache.commons.lang类包引用修改:
例如由
org.apache.commons.lang.xwork.StringUtils
换成
org.apache.commons.lang3.StringUtils
8.如果以前有xwork-conversion.properties文件,且里面有java.lang.Enum=com.opensymphony.xwork2.util.EnumTypeConverter配置,注释之,com.opensymphony.xwork2.util.EnumTypeConverter在新版本里已经不存在了
struts2.3.15.1版本全jar包地址如下:http://pan.baidu.com/s/1vPSdC