aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
struts 2 tags question, certain jsp code not being executed
Url does not have the querystring on using the <s: tags in struts2
Pass parameters to Model from anchor tag
struts 2 example to have a link in one of the Iterated value in the JSP and pass it to an action