wood burning stoves 2.0*
The moose likes Struts and the fly likes struts-ocnfig.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts-ocnfig.xml" Watch "struts-ocnfig.xml" New topic
Author

struts-ocnfig.xml

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

In my struts-config.xml file, I have done a mapping (/city/introdcution) to invoke a forward path="citydetails.do".

when I do a request.getRequestURI() it gives me the path of citydetails.do

Is there any way to get the /city/introduction path from my request object or anyother related object.

Thanks,
Neeraj.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The forward name is something that Struts keeps track of, but once the page is displayed, all you know is the path name, and you lose all reference to the forward name that was used to call the URL.

It's complicated, but here's one way you could find it:

Get the ModuleConfig object. You can do this with the statement:
Once you have this object, you can get the array of ActionConfig objects using the findActionConfigs() method, and then in each action, get the array of ForwardConfig objects using the findForwardConfigs() method. By iterating through all these forwards, you could find the one that matches the path you want. If there's more than one forward that points to the same path, you're out of luck. There's no way to tell which of the two forwards was invoked.

The above assumes you only have one module. If you have more than one, the code would be different. I'm not sure what the differences are. You'd have to research it.
[ June 09, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

Thanks for the inputs. Will try it out and inform.

Thanks,
Neeraj.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts-ocnfig.xml
 
Similar Threads
forward to another action
Drop Down Box in Struts - Select Default Value Implementation
pageContext.request.
Struts
Error in struts-config.xml