VelocityStruts
Other Subprojects
The StrutsLinkTool extends the standard LinkTool to add methods for working with Struts' Actions and Forwards:
<tool> <key>link</key> <scope>request</scope> <class>org.apache.velocity.tools.struts.StrutsLinkTool</class> </tool>
StrutsLinkTool setAction(String action)
/logon.
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">
StrutsLinkTool setForward(String forward)
StrutsLinkTool or null if the
parameter does not map to a valid forward.
The forward URL 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>