类 StrutsLinkTool

所有已实现的接口:
Cloneable

public class StrutsLinkTool extends LinkTool

The StrutsLinkTool extends the standard LinkTool to add methods for working with Struts' Actions and Forwards:

 Template example(s):
   <a href="$link.action.update">update something</a>
   #set( $base = $link.forward.MyPage.anchor('view') )
   <a href="$base.param('select','this')">view this</a>
   <a href="$base.param('select','that')">view that</a>

 Toolbox configuration:
 <tools>
   <toolbox scope="request">
     <tool class="org.apache.velocity.tools.struts.StrutsLinkTool"/>
   </toolbox>
 </tools>
 

This tool may only be used in the request scope.

版本:
$Id: StrutsLinkTool.java 707788 2008-10-24 23:28:06Z nbubna $
作者:
Gabe Sidler, Nathan Bubna
  • 字段详细资料

    • application

      protected ServletContext application
    • get

      private String get
  • 构造器详细资料

    • StrutsLinkTool

      public StrutsLinkTool()
  • 方法详细资料

    • configure

      protected void configure(ValueParser props)
      从类复制的说明: SafeConfig
      Does the actual configuration. This is protected, so subclasses may share the same ValueParser and call configure at any time, while preventing templates from doing so when configure(Map) is locked.
      覆盖:
      configure 在类中 LinkTool
    • get

      public StrutsLinkTool get(String getme)

      This exists to enable a simplified syntax for using this tool in a template. Now, users can do $link.action.saveFoo instead of $link.setAction('saveFoo') and $link.forward.profile instead of $link.setForward('profile'). Neat, eh? :)

      从以下版本开始:
      VelocityTools 1.3
    • setAction

      public StrutsLinkTool setAction(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.

      参数:
      action - an action path as defined in struts-config.xml
      返回:
      a new instance of StrutsLinkTool
    • setForward

      public StrutsLinkTool setForward(String forward)

      Returns a copy of the link with the given global or local 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.

      参数:
      forward - a forward name as defined in struts-config.xml in either global-forwards or in the currently executing action mapping.
      返回:
      a new instance of StrutsLinkTool