wood burning stoves 2.0*
The moose likes Struts and the fly likes Accessing requestURL using OGNL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Accessing requestURL using OGNL" Watch "Accessing requestURL using OGNL" New topic
Author

Accessing requestURL using OGNL

James Gadbury
Greenhorn

Joined: Mar 20, 2009
Posts: 24
I was Googling around looking how to get the requestURL using the ognl syntax #request. I found this post:

http://old.nabble.com/struts-result-going-to-a-current-page-td15509367.html

The way I am doing it is:



The above solution is ugly. Is there a more elegant solution (perhaps something has changed with Struts in the few years that the post was made...) ? Is it possible to use #request.requestURL, or something similar? I tried a few by trial and error and was unable to find a solution on the web.

Thanks for your time. Kind regards,

James
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you use the <s:debug/> tag you can see what's in the value stack and see if anything's changed (I've been out of the loop for about a year). Another trivial option would be to just create an interceptor that puts it on the stack--that's all any new S2 code would do anyway. Or get it in the action.
 
wood burning stoves
 
subject: Accessing requestURL using OGNL
 
Similar Threads
passing form parameters such us textfield values using url tag
<s:url second param null
hide the link in jsp
Struts 2 - Set Action Attribute From Jsp
Struts 2 and UTF-8