This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes link request param to ActionMapping at high level Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "link request param to ActionMapping at high level" Watch "link request param to ActionMapping at high level" New topic

link request param to ActionMapping at high level

Weston Kornfeld

Joined: Mar 01, 2005
Posts: 28
What I want to do is everytime a particular action mapping is called in my web application - I want pass a particular value in the request.

I.e. - if I have / - I want a request param associated with that to be menuValue="menuListCustomers" - likewise if I have an / I would like an associated request param menuValue="menuEditCustomers".

I want to do this at a high level - like in the struts.cofig file or the like - of course, I can find every occurence in my application of where these action mappings are referenced as manually tack on ?menuValue=whatever but I want to avoid scattering it all over the place in my app.

Many Thanks
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
struts provide an option of having some static parameter for every actionmapping through the parameter attriute for the action-mapping tag . This parameter u can get in execute method of ur action class saying mapping.getParmeter ()

is this what u wanted right ??
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can also get the path of the current action with mapping.getPath(). So, for example, at the beginning of each action you could call a utility method with code similar to the following:

Consultant, Sima Solutions
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: link request param to ActionMapping at high level
It's not a secret anymore!