StrutsLinkTool Reference Documentation
The StrutsLinkTool extends the standard
LinkTool
to add methods
for working with Struts' Actions and Forwards:
@@@version@@@, @@@date@@@org.apache.velocity.tools.struts.StrutsLinkTool$linkGabriel SidlerNathan Bubna<tool>
<key>link</key>
<scope>request</scope>
<class>org.apache.velocity.tools.struts.StrutsLinkTool</class>
</tool>
setAction()
Returns a copy of this StrutsLinkTool instance with the given action path
converted into a server-relative URI reference.
StrutsLinkTool setAction(String action)
An action path as defined in struts-config.xml, e.g. /logon
.
A new instance of StrutsLinkTool
.
The action name is translated into a server-relative URI reference. The method does
not check if the specified action has been defined. It will overwrite any
previously set URI reference but will copy the query string.
## a form tag
<form name="form1" action="$link.setAction("demo")">Produces something like:
<form name="form1" action="/myapp/demo.do">
setForward()
Returns a copy of this StrutsLinkTool instance with the given global
forward name converted into a server-relative URI reference.
StrutsLinkTool setForward(String forward)
The name of a global forward as defined in struts-config.xml.
A new instance of StrutsLinkTool
or null
if the
parameter does not map to a valid forward.
The global forward name is translated into a server-relative
URI reference. This method will overwrite any previously set URI
reference but will copy the query string.
## a forward
<a href="$link.setForward("start").addQueryData("key1","val 1")">
My Link</a>Produces something like:
<a href="/myapp/templates/index.vm?key=val+1">My Link</a>