Pages

Monday, April 28, 2014

How to change struts tooltip icon

Man, this morning came my Duh !!!! moment.

The requirement was to change the tooltip image to something that would make our clients happy.
For reasons best known to them, they were very unhappy with the default tooltip,gif provided by struts.

I was like no problemo, that should be simple, we were on struts2.3.16.1, just had to figure out how to specify the tooltip path and put the new image in path.

Google search landed me on this page :
http://struts.apache.org/release/2.3.x/struts2-core/apidocs/org/apache/struts2/components/UIBean.html

Perfect !!! I thought, they specify use tooltipIcon and all will be well.

Tried and tried it did not work.
After about 15 to 20 mins of this decided to read the entire page.

Found that the instructions were not accurate, but the example in the page was accurate.
It was not tooltipIcon but tooltipIconPath that was the correct parameter.

So, finally what I ended up doing was providing the tooltipIconPath in the s:form tag, problem solved.


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