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":web

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

並修改配置文件頭部爲2.5版本的:

apache

<!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+"/";api

5,web.xml中把spa

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

修改成:code

org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter

6,jdk須要1.7 及以上xml

 

 

---------------------------------------------------------
版權全部:snow365.cnblogs.com ,禁止商業用途轉載,如需非商用用途轉載請註明出處。

blog

相關文章
相關標籤/搜索