• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

link request param to ActionMapping at high level

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 /listCustomers.do - I want a request param associated with that to be menuValue="menuListCustomers" - likewise if I have an /editCustomer.do 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
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
struts provide an option of having some static parameter for every actionmapping ....ie 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 ??
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic