Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting name of module from request object  RSS feed

 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming the best object I have to work with is request, can anyone think of a way to retrieve the name of the Struts module associated with the request?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured it out:

ActionMapping mapping = (ActionMapping)request.getAttribute("org.apache.struts.action.mapping.instance");
String module = mapping.getModuleConfig().getPrefix();
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!