public class URL extends ContextBean
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.
NOTE:By default request parameters will be separated using escaped ampersands (i.e., &). 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.
NOTE: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.
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"> <s:param name="id" value="%{'22'}" /> </s:url>
Param
var
actionMapper, COMPONENT_STACK, devMode, parameters, stack, standardAttributesMap, throwExceptionOnELFailure
Constructor and Description |
---|
URL(ValueStack stack,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
Modifier and Type | Method and Description |
---|---|
boolean |
end(Writer writer,
String body)
Callback for the end tag of this component.
|
String |
findString(String expr)
Evaluates the OGNL stack to find a String value.
|
UrlProvider |
getUrlProvider() |
void |
setAction(String action) |
void |
setAnchor(String anchor) |
void |
setEncode(boolean encode) |
void |
setEscapeAmp(boolean escapeAmp) |
void |
setExtraParameterProvider(ExtraParameterProvider provider) |
void |
setForceAddSchemeHostAndPort(boolean forceAddSchemeHostAndPort) |
void |
setIncludeContext(boolean includeContext) |
void |
setIncludeParams(String includeParams) |
void |
setMethod(String method) |
void |
setNamespace(String namespace) |
void |
setPortletMode(String portletMode) |
void |
setPortletUrlType(String portletUrlType) |
void |
setScheme(String scheme) |
void |
setUrlIncludeParams(String urlIncludeParams) |
void |
setUrlRenderer(UrlRenderer urlRenderer) |
void |
setValue(String value) |
void |
setWindowState(String windowState) |
boolean |
start(Writer writer)
Callback for the start tag of this component.
|
getVar, putInContext, setVar
addAllParameters, addParameter, altSyntax, completeExpressionIfAltSyntax, copyParams, determineActionURL, determineNamespace, end, escapeHtmlBody, fieldError, findAncestor, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, getStandardAttributes, isValidTagAttribute, popComponentStack, setActionMapper, setDevMode, setThrowExceptionsOnELFailure, setUrlHelper, stripExpressionIfAltSyntax, toString, usesBody
public URL(ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
public void setUrlIncludeParams(String urlIncludeParams)
public void setUrlRenderer(UrlRenderer urlRenderer)
public void setExtraParameterProvider(ExtraParameterProvider provider)
public boolean start(Writer writer)
Component
public boolean end(Writer writer, String body)
Component
public String findString(String expr)
Component
findString
in class Component
expr
- OGNL expression.public UrlProvider getUrlProvider()
public void setIncludeParams(String includeParams)
public void setScheme(String scheme)
public void setValue(String value)
public void setAction(String action)
public void setNamespace(String namespace)
public void setMethod(String method)
public void setEncode(boolean encode)
public void setIncludeContext(boolean includeContext)
public void setPortletMode(String portletMode)
public void setWindowState(String windowState)
public void setPortletUrlType(String portletUrlType)
public void setAnchor(String anchor)
public void setEscapeAmp(boolean escapeAmp)
public void setForceAddSchemeHostAndPort(boolean forceAddSchemeHostAndPort)
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.