public class StrutsLinkTool extends LinkTool
The StrutsLinkTool extends the standard LinkTool
to add methods
for working with Struts' Actions and Forwards:
setAction(java.lang.String)
and setForward(java.lang.String)
Template example(s): <a href="$link.action.update">update something</a> #set( $base = $link.forward.MyPage.anchor('view') ) <a href="$base.param('select','this')">view this</a> <a href="$base.param('select','that')">view that</a> Toolbox configuration: <tools> <toolbox scope="request"> <tool class="org.apache.velocity.tools.struts.StrutsLinkTool"/> </toolbox> </tools>
This tool may only be used in the request scope.
Modifier and Type | Field and Description |
---|---|
protected javax.servlet.ServletContext |
application |
INCLUDE_REQUEST_PARAMS_KEY, includeRequestParams, request, response
APPEND_PARAMS_KEY, appendParams, charset, CHARSET_KEY, DEFAULT_CHARSET, DEFAULT_SCHEME, FORCE_RELATIVE_KEY, forceRelative, fragment, FRAGMENT_KEY, host, HOST_KEY, HTML_QUERY_DELIMITER, LOG, opaque, path, PATH_KEY, port, PORT_KEY, query, QUERY_KEY, queryDelim, scheme, SCHEME_KEY, SECURE_SCHEME, self, URI_KEY, user, USER_KEY, XHTML_MODE_KEY, XHTML_QUERY_DELIMITER
LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY
Constructor and Description |
---|
StrutsLinkTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
configure(ValueParser props)
Does the actual configuration.
|
StrutsLinkTool |
get(String getme)
This exists to enable a simplified syntax for using this tool in a
template.
|
StrutsLinkTool |
setAction(String action)
Returns a copy of the link with the given action name
converted into a server-relative URI reference.
|
StrutsLinkTool |
setForward(String forward)
Returns a copy of the link with the given global or local forward
name converted into a server-relative URI reference.
|
addMissingRequestParams, addRequestParams, addRequestParamsExcept, getContextPath, getContextURL, getRequestPath, isPathChanged, setFromRequest, setIncludeRequestParams, toString
absolute, absolute, anchor, append, append, appendAsArray, appendPath, appendQuery, combinePath, combineQuery, createURI, debug, debug, decode, decodeQueryPercents, directory, duplicate, duplicate, encode, equals, getAnchor, getAppendParams, getBaseRef, getCharacterEncoding, getDirectory, getFile, getHost, getParams, getPath, getPort, getQuery, getRoot, getScheme, getSelf, getUri, getUser, handleParamsBoolean, hashCode, host, insecure, isAbsolute, isOpaque, isRelative, isSecure, isXHTML, normalizeQuery, param, params, parseQuery, parseQuery, path, port, query, relative, relative, remove, removeParam, root, scheme, secure, set, setAppendParams, setCharacterEncoding, setForceRelative, setFragment, setFromURI, setHost, setParam, setParams, setPath, setPort, setQuery, setScheme, setUserInfo, setXHTML, toQuery, toQuery, toURI, uri, user
configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
protected void configure(ValueParser props)
SafeConfig
public StrutsLinkTool get(String getme)
This exists to enable a simplified syntax for using this tool in a
template. Now, users can do $link.action.saveFoo
instead of
$link.setAction('saveFoo')
and
$link.forward.profile
instead of
$link.setForward('profile')
. Neat, eh? :)
public StrutsLinkTool setAction(String action)
Returns a copy of the link with the given action name converted into a server-relative URI reference. This method does not check if the specified action really is defined. This method will overwrite any previous URI reference settings but will copy the query string.
action
- an action path as defined in struts-config.xmlpublic StrutsLinkTool setForward(String forward)
Returns a copy of the link with the given global or local forward
name converted into a server-relative URI reference. If the parameter
does not map to an existing global forward name, null
is returned. This method will overwrite any previous URI reference
settings but will copy the query string.
forward
- a forward name as defined in struts-config.xml
in either global-forwards or in the currently executing
action mapping.Copyright © 2002–2021 Apache Software Foundation. All rights reserved.