|
|
|
|
| <html>
|
| <head>
|
| <title>VelocityStruts - StrutsLinkTool</title>
|
|
|
| <meta name="author" value="Gabriel Sidler"/>
|
| <meta name="email" value="sidler@apache.org" />
|
|
|
|
|
| </head>
|
|
|
| <body bgcolor="#ffffff" text="#000000" link="#525D76"
|
| alink="#525D76" vlink="#525D76">
|
|
|
| <table border="0" width="100%" cellspacing="4">
|
|
|
| <tr><td colspan="2">
|
|
|
| <a href="http://velocity.apache.org/">
|
| <img src="http://velocity.apache.org/images/velocity_project_wide.png"
|
| align="left" alt="The Velocity Project" border="0"/>
|
| </a>
|
|
|
|
|
|
|
| <a href="index.html">
|
| <img src="../images/velocitystruts.png" align="right" alt="< Velocity Tools - Struts >" border="0"/>
|
| </a>
|
|
|
| </td></tr>
|
|
|
| <tr>
|
| <td colspan="2">
|
| <hr noshade="" size="1"/>
|
| </td>
|
| </tr>
|
|
|
| <tr>
|
|
|
| <td width="20%" valign="top" nowrap="true">
|
|
|
| <p><strong><a href="../">Velocity Tools</a></strong></p>
|
|
|
| <p>
|
| <strong>VelocityStruts</strong>
|
| </p>
|
| <ul>
|
| <li><a href="index.html">Overview</a></li>
|
| <li><a href="index.html#Benefits">Benefits</a></li>
|
| <li><a href="../index.html#Download">Download</a></li>
|
| <li><a href="userguide.html">User Guide</a></li>
|
| <li><a href="userguide.html#Installation">Installation</a></li>
|
| <li><a href="../index.html#Example Applications">Examples</a></li>
|
| <li><a href="../javadoc/index.html">Javadoc</a></li>
|
|
|
| </ul>
|
| <p>
|
| <a href="StrutsTools.html"><strong>VelocityStruts Tools</strong></a>
|
| </p>
|
| <ul>
|
| <li><a href="ActionMessagesTool.html">ActionMessagesTool</a></li>
|
| <li><a href="ErrorsTool.html">ErrorsTool</a></li>
|
| <li><a href="FormTool.html">FormTool</a></li>
|
| <li><a href="MessageTool.html">MessageTool</a></li>
|
| <li><a href="StrutsLinkTool.html">StrutsLinkTool</a></li>
|
| <li><a href="SecureLinkTool.html">SecureLinkTool</a></li>
|
| <li><a href="TilesTool.html">TilesTool</a></li>
|
| <li><a href="ValidatorTool.html">ValidatorTool</a></li>
|
|
|
| </ul>
|
| <p>
|
| <strong>Other Subprojects</strong>
|
| </p>
|
| <ul>
|
| <li><a href="../generic/">GenericTools</a></li>
|
| <li><a href="../view/">VelocityView</a></li>
|
|
|
| </ul>
|
|
|
| <p>
|
| </p>
|
|
|
| </td>
|
|
|
| <!-- RIGHT SIDE MAIN BODY -->
|
| <td colspan="1" valign="top" align="left">
|
| <table border="0" cellspacing="0" cellpadding="2" width="100%">
|
| <tr>
|
| <td colspan="2" bgcolor="#525D76">
|
| <font color="#ffffff" face="arial,helvetica.sanserif">
|
| <a name="StrutsLinkTool Reference Documentation">
|
| <strong>StrutsLinkTool Reference Documentation</strong></a></font>
|
| </td>
|
| </tr>
|
| <tr>
|
| <td NOWRAP> </td>
|
| <td>
|
| <p>The StrutsLinkTool extends the standard |
| <a href="../view/LinkTool.html">LinkTool</a> to add methods |
| for working with Struts' Actions and Forwards:</p>
|
| <ul> |
| <li>translate logical names (Struts forwards, actions ) to URI references, see |
| methods <a href="#setAction()">setAction()</a> and <a href="#setForward()"> |
| setForward()</a></li> |
| </ul>
|
| <table cellpadding="0" cellspacing="0">
|
| <tr><td colspan="2"><strong>Class</strong></td></tr>
|
| <tr><td> </td><td>org.apache.velocity.tools.struts.StrutsLinkTool</td></tr>
|
|
|
| <tr><td colspan="2"><strong>Name</strong></td></tr>
|
| <tr><td> </td><td>$link (this is the recommended name of the tool in
|
| the Velocity context)</td></tr>
|
|
|
| <tr><td colspan="2"><strong>Toolbox Configuration Example</strong></td></tr>
|
| <tr><td> </td><td><pre><tool> |
| <key>link</key> |
| <scope>request</scope> |
| <class>org.apache.velocity.tools.struts.StrutsLinkTool</class> |
| </tool></pre></td></tr>
|
|
|
| <tr><td colspan="2"><strong>Author(s)</strong></td></tr>
|
| <tr>
|
| <td> </td>
|
| <td><a href="mailto:sidler@teamup.com">Gabriel Sidler</a><br>Nathan Bubna<br></td>
|
| </tr>
|
| </table>
|
| <dl>
|
| <dt><strong>Method Overview</strong></dt>
|
| <dd>
|
| <table cellpadding="2" cellspacing="2" border="0">
|
| <tr>
|
| <td bgcolor="EEEEEE" nowrap>
|
| <a href="#setAction()">setAction()</a></td>
|
| <td bgcolor="EEEEEE">
|
| |
| Returns a copy of this StrutsLinkTool instance with the given action path |
| converted into a server-relative URI reference. |
|
|
| </td>
|
| </tr>
|
| <tr>
|
| <td bgcolor="EEEEEE" nowrap>
|
| <a href="#setForward()">setForward()</a></td>
|
| <td bgcolor="EEEEEE">
|
| |
| Returns a copy of this StrutsLinkTool instance with the given |
| global or local |
| forward name converted into a server-relative URI reference. |
|
|
| </td>
|
| </tr>
|
| </table>
|
| </dd>
|
| </dl>
|
| <dl>
|
| <dt><strong>See Also</strong></dt>
|
| <dd>
|
| <see>The <a href="../javadoc/org/apache/velocity/tools/struts/StrutsLinkTool.html">Javadoc</a> for more info.</see>
|
| </dd>
|
| </dl>
|
|
|
| </td>
|
| </tr>
|
| </table>
|
| <table border="0" cellspacing="0" cellpadding="2" width="100%">
|
| <tr>
|
| <td colspan="2" bgcolor="#525D76">
|
| <font color="#ffffff" face="arial,helvetica.sanserif">
|
| <a name="setAction()">
|
| <strong>setAction()</strong></a></font>
|
| </td>
|
| </tr>
|
| <tr>
|
| <td NOWRAP> </td>
|
| <td>
|
|
|
| <p>
|
| <abstract> |
| Returns a copy of this StrutsLinkTool instance with the given action path |
| converted into a server-relative URI reference. |
| </abstract>
|
| </p>
|
| <p>
|
| <table width="100%"><tr><td bgcolor="EEEEEE">
|
| <font size="+1"><code>
|
| <signature> |
| StrutsLinkTool setAction(String action) |
| </signature>
|
| </code></font>
|
| </td></tr></table>
|
| </p>
|
| <dl>
|
| <dt><strong>Parameters</strong></dt>
|
| <dd>
|
| <dl>
|
| <dt>action</dt>
|
| <dd>
|
| <parameter name="action"> |
| An action path as defined in struts-config.xml, e.g. <code>/logon</code>. |
| </parameter>
|
| </dd>
|
|
|
|
|
| </dl>
|
| </dd>
|
| </dl>
|
| <dl>
|
| <dt><strong>Returns</strong></dt>
|
| <dd>
|
| <returns> |
| A new instance of <code>StrutsLinkTool</code>. |
| </returns>
|
| </dd>
|
| </dl>
|
|
|
| <p>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.</p>
|
|
|
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000">
|
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF">
|
| <pre><sourcecode>## a form tag |
| <form name="form1" action="$link.setAction("demo")"></sourcecode></pre>
|
| </td></tr></table>
|
| </td></tr></table>
|
| <p>Produces something like:</p>
|
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000">
|
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF">
|
| <pre><sourcecode><form name="form1" action="/myapp/demo.do"></sourcecode></pre>
|
| </td></tr></table>
|
| </td></tr></table>
|
|
|
| <br clear="all">
|
|
|
| </td>
|
| </tr>
|
| </table>
|
| <table border="0" cellspacing="0" cellpadding="2" width="100%">
|
| <tr>
|
| <td colspan="2" bgcolor="#525D76">
|
| <font color="#ffffff" face="arial,helvetica.sanserif">
|
| <a name="setForward()">
|
| <strong>setForward()</strong></a></font>
|
| </td>
|
| </tr>
|
| <tr>
|
| <td NOWRAP> </td>
|
| <td>
|
|
|
| <p>
|
| <abstract> |
| Returns a copy of this StrutsLinkTool instance with the given |
| global or local |
| forward name converted into a server-relative URI reference. |
| </abstract>
|
| </p>
|
| <p>
|
| <table width="100%"><tr><td bgcolor="EEEEEE">
|
| <font size="+1"><code>
|
| <signature> |
| StrutsLinkTool setForward(String forward) |
| </signature>
|
| </code></font>
|
| </td></tr></table>
|
| </p>
|
| <dl>
|
| <dt><strong>Parameters</strong></dt>
|
| <dd>
|
| <dl>
|
| <dt>forward</dt>
|
| <dd>
|
| <parameter name="forward"> |
| The name of a global or local forward as defined in |
| struts-config.xml. (global-forward section for global |
| or within an action mapping for local forwards). |
| </parameter>
|
| </dd>
|
|
|
|
|
| </dl>
|
| </dd>
|
| </dl>
|
| <dl>
|
| <dt><strong>Returns</strong></dt>
|
| <dd>
|
| <returns> |
| A new instance of <code>StrutsLinkTool</code> or <code>null</code> if the |
| parameter does not map to a valid forward. |
| </returns>
|
| </dd>
|
| </dl>
|
|
|
| <p>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.</p>
|
|
|
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000">
|
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF">
|
| <pre><sourcecode>## a forward |
| <a href="$link.setForward("start").addQueryData("key1","val 1")"> |
| My Link</a></sourcecode></pre>
|
| </td></tr></table>
|
| </td></tr></table>
|
| <p>Produces something like:</p>
|
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000">
|
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF">
|
| <pre><sourcecode><a href="/myapp/templates/index.vm?key=val+1">My Link</a></sourcecode></pre>
|
| </td></tr></table>
|
| </td></tr></table>
|
|
|
| <br clear="all">
|
|
|
| </td>
|
| </tr>
|
| </table>
|
|
|
| </td>
|
|
|
| </tr>
|
|
|
| <!-- FOOTER SEPARATOR -->
|
| <tr>
|
| <td colspan="2">
|
| <hr noshade="" size="1"/>
|
| </td>
|
| </tr>
|
|
|
| <!-- PAGE FOOTER -->
|
| <tr><td colspan="2">
|
| <div align="center"><font color="#525D76" size="-1"><em>
|
| Copyright © 1999-2003, Apache Software Foundation
|
| </em></font></div>
|
| </td></tr>
|
|
|
| </table>
|
| </body>
|
| </html>
|