struts upgrade to 2.5.2 problems encountered and solutions recommended by of

  • 2020-05-12 02:40:50
  • OfStack

The original version was 2.3.x, which needs to be upgraded to 2.5.2 for security reasons.

Version 1,2.5.2 no longer provides xwork.jar, but is integrated into the struts-core package.

2. If the method cannot be accessed, we need to add strict-method-invocation ="false" in each action configuration file:


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

And modify the profile header to be version 2.5:


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

3. Failure of session. For weblogic server, add session-descriptor node:


<?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 version jdk requires 1.7 5, web.xml


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

Is amended as:


org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter

Related articles: