Apache Struts 2 Documentation > Home > Guides > Tag Developers Guide > Struts Tags > Tag Reference > Generic Tag Reference > url
Added by digi9ten, last edited by Don Brown on Jan 06, 2007  (view change)
Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.

Description

This tag is used to create a URL.

You can use the "param" tag inside the body to provide additional request parameters.

NOTE:

When includeParams is 'all' or 'get', the parameter defined in param tag will take precedence and will not be overriden if they exists in the parameter submitted. For example, in Example 3 below, if there is a id parameter in the url where the page this tag is included like http://://editUser.action?id=3333&name=John the generated url will be http://:/context>/editUser.action?id=22&name=John cause the parameter defined in the param tag will take precedence.

Parameters

Name

Required

Default

Evaluated

Type

Description

action false true String he action generate url for, if not using value
anchor false true String The anchor for this URL
encode false true true Boolean Whether to encode parameters
id false true String id for referencing element. For UI and form tags it will be used as HTML id attribute
includeContext false true true Boolean Whether actual context should be included in url
includeParams false get true String The includeParams attribute may have the value 'none', 'get' or 'all'
method false true String The method of action to use
namespace false true String The namespace to use
portletMode false true String The resulting portlet mode
portletUrlType false true String Specifies if this should be a portlet render or action url
scheme false true String Set scheme attribute
value false true String The target value to use, if not using action
windowState false true String The resulting portlet window state

Examples

<-- Example 1 -->
<s:url value="editGadget.action">
    <s:param name="id" value="%{selected}" />
</s:url>

<-- Example 2 -->
<s:url action="editGadget">
    <s:param name="id" value="%{selected}" />
</s:url>

<-- Example 3-->
<s:url includeParams="get"  >
    &lt:param name="id" value="%{'22'}" />
</s:url>