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