Pages

Monday, April 28, 2014

Action mapping broke when we moved from Struts 2.1.8 to 2.3.16

We are in the habit of coding the Continue, Cancel and back buttons as shown below:
 


As you can see we were totally reliant on action:  ie the  action mapping mechanism provided by the DefaultActionMapper, we had 1000s of jsps that were similar.

It all worked beautifully as long as we were on 2.1.8, then came the news that 2.1.8 has a security hole. We had to upgrade to 2.3.16.1 ASAP.

To my horror none of the action mappings worked, clicking on any button submitted the form.
Imagine filling incorrect details and clicking cancel, and getting the following message : 'Your request has been Submitted'. This was a surefire way to get a drubbing from management.

Luckily I came across the following article, pls do read for details:
https://struts.apache.org/release/2.3.x/docs/s2-018.html

Oh, what joy!!!
All I had to do was to include the following properties in the struts.properties file and we were good to go.

Properties to be included in struts.properties:

struts.mapper.action.prefix.enabled=true
struts.mapper.action.prefix.crossNamespaces=false


No comments:

Post a Comment