Class VelocityViewTag

  • All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag

    public class VelocityViewTag
    extends javax.servlet.jsp.tagext.BodyTagSupport

    This tag enables use of Velocity and VelocityTools within JSP files and tags. This makes it trivial to render embedded VTL (Velocity Template Language) or include a separate Velocity template within a JSP using the current page context. This also automatically provides the typical VelocityView toolbox support, much like the VelocityViewServlet and VelocityLayoutServlets have. In fact, this will by default share the VelocityView instance used with those servlets. This allows for consistent configuration and shared resources (better performance).

    Since:
    VelocityTools 2.0
    Version:
    $Id: VelocityViewTag.java,v 1.1 2001/08/14 00:07:39 geirm Exp $
    Author:
    Nathan Bubna
    See Also:
    Serialized Form
    • Field Detail

      • repository

        protected transient org.apache.velocity.runtime.resource.util.StringResourceRepository repository
      • scope

        protected String scope
      • template

        protected String template
      • bodyContentKey

        protected String bodyContentKey
    • Constructor Detail

      • VelocityViewTag

        public VelocityViewTag()
    • Method Detail

      • reset

        protected void reset()
        Release any per-invocation resources, resetting any resources or state that should be cleared between successive invocations of Tag.doEndTag() and Tag.doStartTag().
      • setId

        public void setId​(String id)
        Overrides:
        setId in class javax.servlet.jsp.tagext.TagSupport
      • getLogId

        protected String getLogId()
      • setVar

        public void setVar​(String var)
      • getVar

        public String getVar()
      • setScope

        public void setScope​(String scope)
      • getScope

        public String getScope()
      • setTemplate

        public void setTemplate​(String template)
      • getTemplate

        public String getTemplate()
      • setBodyContentKey

        public void setBodyContentKey​(String key)
      • getBodyContentKey

        public String getBodyContentKey()
      • setCache

        public void setCache​(String s)
      • getCache

        public String getCache()
      • setVelocityView

        public void setVelocityView​(VelocityView view)
      • setViewToolContext

        public void setViewToolContext​(ViewToolContext context)
      • getRepository

        public org.apache.velocity.runtime.resource.util.StringResourceRepository getRepository()
      • setRepository

        public void setRepository​(org.apache.velocity.runtime.resource.util.StringResourceRepository repo)
      • doStartTag

        public int doStartTag()
                       throws javax.servlet.jsp.JspException
        Specified by:
        doStartTag in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
        Throws:
        javax.servlet.jsp.JspException
      • doEndTag

        public int doEndTag()
                     throws javax.servlet.jsp.JspException
        Specified by:
        doEndTag in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
        Throws:
        javax.servlet.jsp.JspException
      • initializeView

        protected void initializeView()
      • hasContent

        protected boolean hasContent()
      • isCached

        protected boolean isCached()
      • toScopeInt

        protected static int toScopeInt​(String scope)
      • cache

        protected void cache​(String name,
                             String template)
      • release

        public void release()
        Release any per-instance resources, releasing any resources or state before this tag instance is disposed.
        Specified by:
        release in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        release in class javax.servlet.jsp.tagext.BodyTagSupport
        See Also:
        Tag.release()