当前位置: 移动技术网 > IT编程>开发语言>Java > struts升级到2.5.2遇到的问题及解决方案(推荐)

struts升级到2.5.2遇到的问题及解决方案(推荐)

2019年07月22日  | 移动技术网IT编程  | 我要评论

原来的版本是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

以上所述是小编给大家介绍的struts升级到2.5.2遇到的问题及解决方案(推荐),希望对大家有所帮助

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网