This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting name of module from request object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting name of module from request object" Watch "Getting name of module from request object" New topic
Author

Getting name of module from request object

Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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?


A good workman is known by his tools.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Figured it out:

ActionMapping mapping = (ActionMapping)request.getAttribute("org.apache.struts.action.mapping.instance");
String module = mapping.getModuleConfig().getPrefix();
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting name of module from request object
 
Similar Threads
Obtaining "put" values from Tiles.
JSP & useBean
Java SE6 client for EJB - Error in lookup
PageContext methods in EL?
Setting the value in <s:textfield from request scope