This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Accessing requestURL using OGNL" Watch "Accessing requestURL using OGNL" New topic

Accessing requestURL using OGNL

James Gadbury

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:

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,

David Newton

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.
subject: Accessing requestURL using OGNL
Similar Threads
Struts 2 and UTF-8
Struts 2 - Set Action Attribute From Jsp
hide the link in jsp
<s:url second param null
passing form parameters such us textfield values using url tag