wood burning stoves 2.0*
The moose likes Struts and the fly likes Is there a Struts tag to get a full url? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is there a Struts tag to get a full url?" Watch "Is there a Struts tag to get a full url?" New topic
Author

Is there a Struts tag to get a full url?

William Stafford
Ranch Hand

Joined: Dec 13, 2004
Posts: 109
I'm working on a web service and I want to sent the url for the help page in the header of every response.

I thought the Struts url tag would do the trick but it produces a relative url or at least that is what I see when I do the following:

url=<url namespace="/rest/list" action="help"/>

This tag usages produces url=/my-service/rest/list/help

Is there a way to get a url of the form http://<host name>/my-service/rest/list/help

I'm using struts tags in Freemarker so If there is a Freemarker tag that would suffice.
(and the actual syntax in Freemarker is <@s.url namespace="/rest/list" action="help"/>)

Thanks for any help or guidance,
-=beeky
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you looked at the docs for the URL tag?
William Stafford
Ranch Hand

Joined: Dec 13, 2004
Posts: 109
I'm not sure I see the point of this game.

I post a question.

You think the question is so stupid or the answer is so obvious that instead of
1. actually answering the question
2. pointing to the docs that answer the question
3. giving any sort of useful advice
4. doing nothing

you reply RTFM. What's the point?
I ask a question because I want an answer.
You respond with a useless reply because you want to point out that, unlike yourself, I am an idiot who can't be
bothered to try to search for an answer before asking for help.

It seems like a huge presumption on your part and a complete waste of time for both of us.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So don't waste your time--sorry; won't tell you to RTFM again. Of course, if you *had* RTFM, you would have seen the forceAddSchemeHostAndPort attribute.

My question about you reading it wasn't just me patting myself on my back for having RTFM already, it was asking you if you'd read it. If you had said no, I would have suggested reading it. If you had said yes, I would have asked if you had had a specific problem with the attribute in question.

Do not ascribe to malice that which can be explained by someone who doesn't have a lot of time to spend responding to questions, but rather chooses to do as much as he can in the limited amount of time he has.

I'm sure other people here will be happy to answer your future questions--I'll not annoy you with mine any more.
 
jQuery in Action, 2nd edition
 
subject: Is there a Struts tag to get a full url?
 
Similar Threads
Returning A List Of Variables From A Folder Of Documents And Returning Them Into A New Document
problem calling static method using OGNL
Can not Populate the form on combo box change
Struts 2 client side validation not working with xml configuration
Need help with binding. tags for composite.xml files