时间:2021-03-04 13:51:17 | 栏目:JAVA代码 | 点击:次
原来的版本是2.3.x,由于安全原因需要升级到2.5.2。
1,2.5.2版本不再提供xwork.jar ,整合到了 struts-core包中。
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,session失效的问题,针对weblogic server,增加session-descriptor节点:
<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"> <context-root>/ynwjnw</context-root> <container-descriptor> <servlet-reload-check-secs>-1</servlet-reload-check-secs> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> <session-descriptor> <cookie-name>JSESSIONID1</cookie-name> </session-descriptor> </weblogic-web-app>
4,2.5.2版本jdk要求1.7 5,web.xml中把
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
修改为:
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter