Save This Page
Home » struts- » org.apache » struts2 » components » [javadoc | source]
public class: URL [javadoc | source]

This tag is used to create a URL.

You can use the <param> tag inside the body to provide additional request parameters. If the value of a param is an Array or an Iterable all the values will be added to the URL.


By default request parameters will be separated using escaped ampersands (i.e., &amp;). This is necessary for XHTML compliance, however, when using the URL generated by this tag with the <s:property> tag, the escapeAmp attribute should be used to disable ampersand escaping.


When includeParams is 'all' or 'get', the parameter defined in a <param> tag will take precedence over any params included due to the includeParams attribute. For example, in Example 3 below, if there is a id parameter in the url where the page this tag is included like http://<host>:<port>/<context>/editUser.action?id=3333&name=John the generated url will be http://<host>:<port>/<context>/editUser.action?id=22&name=John because the parameter defined in the param tag will take precedence.


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

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

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

Fields inherited from org.apache.struts2.components.ContextBean:
Fields inherited from org.apache.struts2.components.Component:
COMPONENT_STACK,  stack,  parameters,  actionMapper,  throwExceptionOnELFailure
 public URL(ValueStack stack,
    HttpServletRequest req,
    HttpServletResponse res) 
Method from org.apache.struts2.components.URL Summary:
end,   findString,   getUrlProvider,   setAction,   setAnchor,   setEncode,   setEscapeAmp,   setExtraParameterProvider,   setForceAddSchemeHostAndPort,   setIncludeContext,   setIncludeParams,   setMethod,   setNamespace,   setPortletMode,   setPortletUrlType,   setScheme,   setUrlIncludeParams,   setUrlRenderer,   setValue,   setWindowState,   start
Methods from org.apache.struts2.components.ContextBean:
getVar,   putInContext,   setId,   setVar
Methods from org.apache.struts2.components.Component:
addAllParameters,   addParameter,   altSyntax,   altSyntax,   completeExpressionIfAltSyntax,   copyParams,   determineActionURL,   determineNamespace,   end,   end,   fieldError,   findAncestor,   findString,   findString,   findStringIfAltSyntax,   findValue,   findValue,   findValue,   getComponentStack,   getParameters,   getStack,   popComponentStack,   setActionMapper,   setThrowExceptionsOnELFailure,   start,   stripExpressionIfAltSyntax,   stripExpressionIfAltSyntax,   toString,   usesBody
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.components.URL Detail:
 public boolean end(Writer writer,
    String body) 
 public String findString(String expr) 
 public UrlProvider getUrlProvider() 
 public  void setAction(String action) 
 public  void setAnchor(String anchor) 
 public  void setEncode(boolean encode) 
 public  void setEscapeAmp(boolean escapeAmp) 
 public  void setExtraParameterProvider(ExtraParameterProvider provider) 
 public  void setForceAddSchemeHostAndPort(boolean forceAddSchemeHostAndPort) 
 public  void setIncludeContext(boolean includeContext) 
 public  void setIncludeParams(String includeParams) 
 public  void setMethod(String method) 
 public  void setNamespace(String namespace) 
 public  void setPortletMode(String portletMode) 
 public  void setPortletUrlType(String portletUrlType) 
 public  void setScheme(String scheme) 
 public  void setUrlIncludeParams(String urlIncludeParams) 
 public  void setUrlRenderer(UrlRenderer urlRenderer) 
 public  void setValue(String value) 
 public  void setWindowState(String windowState) 
 public boolean start(Writer writer)