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.

This class is equipped to be used with a toolbox manager, for example the ServletToolboxManager included with VelServlet. This class implements interface ViewTool, which allows a toolbox manager to pass the required context information.

This class is not thread-safe by design. A new instance is needed for the processing of every template request. This means this tool should only be used in the request scope, not application or session scopes.

Version:
$Id: StrutsLinkTool.java,v 1.3 2003/05/28 00:17:15 nbubna Exp $
Author:
Gabe Sidler, Nathan Bubna

Nested Class Summary
 
Nested classes inherited from class org.apache.velocity.tools.view.tools.LinkTool
LinkTool.QueryPair
 
Field Summary
 
Fields inherited from class org.apache.velocity.tools.view.tools.LinkTool
application, HTML_QUERY_DELIMITER, request, response, XHTML_QUERY_DELIMITER
 
Constructor Summary
StrutsLinkTool()
           
 
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, 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
 

Constructor Detail

StrutsLinkTool

public StrutsLinkTool()
Method Detail

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