It's not a secret anymore!
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
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.
I agree. Here's the link:
subject: Accessing requestURL using OGNL
It's not a secret anymore!