Class ViewContextTool

  • Direct Known Subclasses:
    ContextTool

    public class ViewContextTool
    extends ContextTool

    Extension of ContextTool that includes keys and values from the HttpServletRequest, HttpSession and ServletContext.

     Template example(s):
      #foreach( $key in $context.keys )
        $key = $context.get($key)
      #end
    
     Toolbox configuration:
     <tools>
       <toolbox scope="request">
         <tool class="org.apache.velocity.tools.view.ViewContextTool"/>
       </toolbox>
     </tools>
     

    This class is only designed for use as a request-scope VelocityView tool.

    Since:
    VelocityTools 2.0
    Version:
    $Id: ViewContextTool.java 385122 2006-03-11 18:37:42Z nbubna $
    Author:
    Nathan Bubna
    • Field Detail

      • request

        protected javax.servlet.http.HttpServletRequest request
      • session

        protected javax.servlet.http.HttpSession session
      • application

        protected javax.servlet.ServletContext application
    • Constructor Detail

      • ViewContextTool

        public ViewContextTool()
    • Method Detail

      • configure

        protected void configure​(ValueParser parser)
        Description copied from class: ContextTool
        Initializes this instance for the current request. Also looks for a safe-mode configuration setting. By default, safeMode is true and thus keys with '.' in them are hidden.
        Overrides:
        configure in class ContextTool