org.apache.velocity.tools.struts
Class StrutsLinkTool
java.lang.Object
org.apache.velocity.tools.view.tools.LinkTool
org.apache.velocity.tools.struts.StrutsLinkTool
- All Implemented Interfaces:
- java.lang.Cloneable, ViewTool
- public class StrutsLinkTool
- extends LinkTool
View tool to work with URI links in Struts.
Template example(s):
<a href="$link.setAction('update')">update something</a>
#set( $base = $link.setForward('MyPage.vm').setAnchor('view') )
<a href="$base.addQueryData('select','this')">view this</a>
<a href="$base.addQueryData('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 72114 2004-11-11 06:26:27Z nbubna $
- Author:
- Gabe Sidler, Nathan Bubna
Field Summary |
protected static org.apache.commons.logging.Log |
LOG
|
Method Summary |
StrutsLinkTool |
setAction(java.lang.String action)
Returns a copy of the link with the given action name
converted into a server-relative URI reference. |
StrutsLinkTool |
setForward(java.lang.String forward)
Returns a copy of the link with the given global forward name
converted into a server-relative URI reference. |
Methods inherited from class org.apache.velocity.tools.view.tools.LinkTool |
addQueryData, copyWith, copyWith, copyWithAnchor, encodeURL, getAnchor, getBaseRef, getContextPath, getContextURL, getQueryData, getURI, init, setAnchor, setRelative, setURI, setXhtml, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LOG
protected static final org.apache.commons.logging.Log LOG
StrutsLinkTool
public StrutsLinkTool()
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 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.
- Parameters:
forward
- a global forward name as defined in struts-config.xml
- Returns:
- a new instance of StrutsLinkTool
Copyright (c) 2003 Apache Software Foundation