zoukankan      html  css  js  c++  java
  • 问候struts2升级的新版本2.5

    1、jar包的处理

    struts2升级到2.5.16版本,大概需要替换更新的架包如下:

    struts2-core-2.5.16.jar、struts2-json-plugin-2.5.16.jar、log4j-api-2.10.0.jar、xstream-1.4.10.jar、commons-io-2.5.jar、commons-lang3-3.6.jar

    commons-fileupload-1.3.3.jar、freemarker-2.3.26-incubating.jar、javassist-3.20.0-GA.jar、jackson-annotations-2.9.0.jar、jackson-core-2.9.4.jar

    jackson-databind-2.9.4.jar、jackson-dataformat-xml-2.1.2.jar、struts2-rest-plugin-2.5.16.jar

    删掉xwork-core-2.3.28.1.jar

    2、web.xml的处理

    把“<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>”修改成“<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>”

    3、所有的strut.xml中添加如下:

    眉头:修改成

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
    "http://struts.apache.org/dtds/struts-2.5.dtd">
    <struts>

    如果action中使用通配符的话,需要在action便签之前添加:这是因为新的版本使用的新的安全机制

    <global-allowed-methods>regex:.*</global-allowed-methods>

     

    由于新版本的Struts默认不能修改action的访问后缀,不能使用通配的方式调用action里的方法,所以添加(注意下,这个可能不是必要的

    注意下放的位置

    <constant name="struts.enable.DynamicMethodInvocation" value="true"/>
    <constant name="struts.enable.SlashesInActionNames" value="true"/>

    使得<constant name="struts.action.extension" value="do" />可以生效

    <package name="mypackage" namespace="/" extends="struts-default" strict-method-invocation="false"> 注意这里添加了strict-method-invocation="false"(注意下,这个可能不是必要的

     还有一点是个坑呀:

     java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V,让我很是费劲了一番,后来,我就拼命的google和百度,结果还是不行,费了我一个下午和一个早上的时间,最后还是不行,我彻底的服了。最后找到了解决的办法:

    出现<init>(Z)V将
    将cglib.jar 由2.1版本 改为 2.2
    出现<init>(I)V将
    将cglib.jar 由2.2版本 改为 2.1

    cglib.jar 下载地址    http://www.java2s.com/Code/Jar/c/Downloadcglib220jar.htm   点击下面圈起来的就下载了

    如果项目还有有问题的话,接着升级其他的jar包即可

    梦想这东西和经典一样,永远不会随时间而褪色,反而更加珍贵!
  • 相关阅读:
    085 Maximal Rectangle 最大矩形
    084 Largest Rectangle in Histogram 柱状图中最大的矩形
    083 Remove Duplicates from Sorted List 有序链表中删除重复的结点
    082 Remove Duplicates from Sorted List II 有序的链表删除重复的结点 II
    081 Search in Rotated Sorted Array II 搜索旋转排序数组 ||
    080 Remove Duplicates from Sorted Array II 从排序阵列中删除重复 II
    079 Word Search 单词搜索
    078 Subsets 子集
    bzoj2326: [HNOI2011]数学作业
    bzoj2152: 聪聪可可
  • 原文地址:https://www.cnblogs.com/haoxiu1004/p/9283040.html
Copyright © 2011-2022 走看看