Class StrutsLinkTool
- java.lang.Object
-
- org.apache.velocity.tools.view.tools.LinkTool
-
- org.apache.velocity.tools.struts.StrutsLinkTool
-
- All Implemented Interfaces:
java.lang.Cloneable
public class StrutsLinkTool extends LinkTool
View tool to work with URI links in Struts.
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: <tool> <key>link</key> <scope>request</scope> <class>org.apache.velocity.tools.struts.StrutsLinkTool</class> </tool>This tool should only be used in the request scope.
- Version:
- $Id: StrutsLinkTool.java 536364 2007-05-08 22:39:44Z nbubna $
- Author:
- Gabe Sidler, Nathan Bubna
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.velocity.tools.view.tools.LinkTool
LinkTool.QueryPair
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringgetprotected static org.apache.commons.logging.LogLOG-
Fields inherited from class org.apache.velocity.tools.view.tools.LinkTool
application, AUTO_IGNORE_PARAMETERS_KEY, HTML_QUERY_DELIMITER, request, response, SELF_ABSOLUTE_KEY, SELF_INCLUDE_PARAMETERS_KEY, XHTML_QUERY_DELIMITER
-
-
Constructor Summary
Constructors Constructor Description StrutsLinkTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StrutsLinkToolget(java.lang.String getme)This exists to enable a simplified syntax for using this tool in a template.StrutsLinkToolsetAction(java.lang.String action)Returns a copy of the link with the given action name converted into a server-relative URI reference.StrutsLinkToolsetForward(java.lang.String forward)Returns a copy of the link with the given global or local forward name converted into a server-relative URI reference.-
Methods inherited from class org.apache.velocity.tools.view.tools.LinkTool
absolute, addAllParameters, addIgnore, addQueryData, addQueryData, anchor, configure, copyWith, copyWith, copyWith, copyWithAnchor, copyWithIgnore, duplicate, encodeURL, getAnchor, getBaseRef, getContextPath, getContextURL, getParams, getQueryData, getRequestPath, getSelf, getUri, getURI, init, param, params, relative, setAbsolute, setAnchor, setAutoIgnoreParameters, setRelative, setSelfAbsolute, setSelfIncludeParameters, setURI, setXhtml, toString, uri
-
-
-
-
Method Detail
-
get
public StrutsLinkTool get(java.lang.String getme)
This exists to enable a simplified syntax for using this tool in a template. Now, users can do
$link.action.saveFooinstead of$link.setAction('saveFoo')and$link.forward.profileinstead of$link.setForward('profile'). Neat, eh? :)- Since:
- VelocityTools 1.3
-
setAction
public StrutsLinkTool setAction(java.lang.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.
- Parameters:
action- an action path as defined in struts-config.xml- Returns:
- a new instance of StrutsLinkTool
-
setForward
public StrutsLinkTool setForward(java.lang.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,
nullis returned. This method will overwrite any previous URI reference settings but will copy the query string.- Parameters:
forward- a forward name as defined in struts-config.xml in either global-forwards or in the currently executing action mapping.- Returns:
- a new instance of StrutsLinkTool
-
-