• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts-ocnfig.xml

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks,
Neeraj.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic