struts2升级

1- 替换jar包

下载2.3.15对应的jar包,替换原来的2.0的jar包。 
commons-fileupload-1.3.jar
commons-io-2.0.1.jar
commons-lang3-3.1.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
log4j-1.2.17.jar
ognl-3.0.6.jar
struts2-core-2.3.15.2.jar
xwork-core-2.3.15.2.jar

删除相关的jar包
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemarker-2.3.8.jar
log4j-1.2.13.jar
ognl-2.6.11.jar
struts2-core-2.0.11.1.jar
xwork-2.0.4.jar

2- 修改web.xml文件

<!--  去除
    <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>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
	-->


    <filter>
         <filter-name>struts-prepare</filter-name>
         <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
    </filter>
    <filter-mapping>
         <filter-name>struts-prepare</filter-name>
         <url-pattern>/*</url-pattern>
    </filter-mapping>
     
    <filter>
        <filter-name>struts-execute</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>struts</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>struts</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

3- 修改struts.xml文件

interceptor-ref 的属性中,-修改成对应的大写字母。
比如<interceptor-ref name="servlet-config" /> 修改成 <interceptor-ref name="servletConfig" />
原来为:
<interceptor-ref name="exception" />
				<interceptor-ref name="alias" />
				<interceptor-ref name="servlet-config" />
				<interceptor-ref name="prepare" />
				<interceptor-ref name="i18n" />
				<interceptor-ref name="chain" />
				<interceptor-ref name="debugging" />
				<interceptor-ref name="profiling" />
				<interceptor-ref name="scoped-model-driven" />
				<interceptor-ref name="model-driven" />
				<interceptor-ref name="fileUpload" />
				<interceptor-ref name="checkbox" />
				<interceptor-ref name="static-params" />
				<interceptor-ref name="params">

修改后为:
<interceptor-ref name="exception" />
				<interceptor-ref name="alias" />
				<interceptor-ref name="servletConfig" />
				<interceptor-ref name="prepare" />
				<interceptor-ref name="i18n" />
				<interceptor-ref name="chain" />
				<interceptor-ref name="debugging" />
				<interceptor-ref name="profiling" />
				<interceptor-ref name="scopedModelDriven" />
				<interceptor-ref name="modelDriven" />
				<interceptor-ref name="fileUpload" />
				<interceptor-ref name="checkbox" />
				<interceptor-ref name="staticParams" />
				<interceptor-ref name="params">

4- 修改jsp文件标签

required="false"  替换为 requiredLabel="false"

5- 替换依赖的文件

以下java文件 依赖 com.opensymphony.xwork2.util.TypeConversionException
DateMinuteConverter.java
DateConverter.java
进行修改 去依赖 重新编译









你可能感兴趣的:(struts2,升级,2.3.15.2)