struts从2.3.X升级到2.5.18中遇到的问题及解决办法


1,2.5.X版本不再提供xwork.jar ,整合到了 struts-core包中。
2,需要升级替换的jar文件:
commons-lang
commons-lang3
ognl
其他所有struts2开头的jar
删除xwork包
2,方法不能访问的问题,需要在每个action配置文件中加上 strict-method-invocation="false":

<package name="login" namespace="/login" extends="struts-default" strict-method-invocation="false">

并修改配置文件头部为2.5版本的:

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">

3,“找不到 org.apache.logging.log4j.Logger类”:引入log4j-api-2.7.0.jar,版本不能太高,可能会报错。

4,如果提交表单出现404,需要将表单提交的路径改成使用basepath作位前缀:
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

5,web.xml中把

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

修改为:

org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter

6,jdk需要1.7 及以上

 

 

---------------------------------------------------------
版权所有:snow365.cnblogs.com ,禁止商业用途转载,如需非商用用途转载请注明出处。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM