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 url tag 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 "url tag" Watch "url tag" New topic

url tag

deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
does the below tag mean, that I am trying to use session through url rewriting

<s:url id="url" action="download"/><s:a href="%{url}">Download image file.</s:a>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
While it is true that Struts tags involving a URL do perform URL rewriting, the main purpose of the code you've shown us is to create and use a URL for a specific action. If you're using the default suffix of ".action", the URL would translate to something like:


It's considered a better practice to use this method rather than specifying the ".action" because even though the default suffix is .action, you could set it to something else. The code you have shown us will work regardless of what the suffix is.

Consultant, Sima Solutions
I agree. Here's the link:
subject: url tag
Similar Threads
Struts 2: Iterating through Alphabetized Map
Pass parameters to Model from anchor tag
Url does not have the querystring on using the <s: tags in struts2
struts 2 tags question, certain jsp code not being executed
struts 2 example to have a link in one of the Iterated value in the JSP and pass it to an action