struts2.3.33升级到2.5.30

struts2.3.33升级到2.5.30

1、struts2.5.30 jar包下载

https://struts.apache.org/download.cgi

2、jar包

  • struts2核心包替换
    struts2-convention-plugin-2.3.33.jar ->struts2-convention-plugin-2.5.30.jar
    struts2-dojo-plugin-2.3.33.jar (删除)
    struts2-jasperreports-plugin-2.3.33.jar (删除)
    struts2-json-plugin-2.3.33.jar -> struts2-json-plugin-2.5.30.jar
    struts2-rest-plugin-2.3.24.1.jar -> struts2-rest-plugin-2.5.30.jar
    struts2-spring-plugin-2.3.33.jar -> struts2-spring-plugin-2.5.30.jar
    javassist-3.12.0.GA.jar -> javassist-3.18.1-GA.jar
    log4j-1.2.17.jar -> log4j-api-2.12.4.jar
    ognl-3.0.19.jar-> ognl-3.1.29.jar
    xml-apis.jar-> xml-apis-1.0.b2.jar
    xwork-core-2.3.33.jar(删除)
    cglib-2.2.jar -> cglib-3.1.jar
    xstream-1.2.2.jar -> xstream-1.4.17.jar
    jackson-annotations-2.10.5.jar、jackson-core-2.10.5.jar、jackson-databind-2.10.5.1.jar(新增)
    commons-lang3-3.2.jar->commons-lang3-3.8.1.jar

3、web.xml


    org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter

StrutsPrepareAndExecuteFilter类包名变更


    org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter

4、struts.xml修改

替换头


添加strict-method-invocation="false"和regex:.*

    

...

      ...
    
    true
        false
        text/plain
        true
    

regex:.*

5、 escape="false"属性替换成escapeHtml="false"

6、maxLength属性无效,直接删除

7、 json解析异常

新增了strut2-rest-plugin-2.5.30.jar后,会导致json解析异常,需要在struts.xml中配置json解析bean,然后在struts.properies中配置struts.rest.handlerOverride.json和struts.rest.content.restrictToGET=false
工程中没有struts.properies文件,在config下新建一个struts.properies

//struts2.xml
 
//struts.properies
struts.rest.handlerOverride.json=customJson
struts.rest.content.restrictToGET=false

具体参考https://blog.csdn.net/a_c_c_a/article/details/79920559

你可能感兴趣的:(struts2.3.33升级到2.5.30)