Class VelocityViewTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.velocity.tools.view.jsp.VelocityViewTag
- All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.apache.velocity.tools.view.ViewToolContextstatic final Stringprotected org.apache.velocity.runtime.resource.util.StringResourceRepositoryprotected Stringprotected Stringprotected Stringprotected org.apache.velocity.tools.view.VelocityViewFields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContentFields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContextFields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAGFields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidintdoEndTag()intprotected voidgetCache()protected StringgetLogId()protected Stringorg.apache.velocity.runtime.resource.util.StringResourceRepositorygetScope()getVar()org.apache.velocity.tools.view.VelocityVieworg.apache.velocity.tools.view.ViewToolContextprotected booleanprotected voidprotected booleanisCached()voidrelease()Release any per-instance resources, releasing any resources or state before this tag instance is disposed.protected voidrenderBody(Writer out) protected voidrenderContent(Writer out) protected voidreset()Release any per-invocation resources, resetting any resources or state that should be cleared between successive invocations ofTag.doEndTag()andTag.doStartTag().voidsetBodyContentKey(String key) voidvoidvoidsetRepository(org.apache.velocity.runtime.resource.util.StringResourceRepository repo) voidvoidsetTemplate(String template) voidvoidsetVelocityView(org.apache.velocity.tools.view.VelocityView view) voidsetViewToolContext(org.apache.velocity.tools.view.ViewToolContext context) protected static inttoScopeInt(String scope) Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContentMethods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValueMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
-
Field Details
-
DEFAULT_BODY_CONTENT_KEY
- See Also:
-
view
protected transient org.apache.velocity.tools.view.VelocityView view -
context
protected transient org.apache.velocity.tools.view.ViewToolContext context -
repository
protected transient org.apache.velocity.runtime.resource.util.StringResourceRepository repository -
var
-
scope
-
template
-
bodyContentKey
-
-
Constructor Details
-
VelocityViewTag
public VelocityViewTag()
-
-
Method Details
-
reset
protected void reset()Release any per-invocation resources, resetting any resources or state that should be cleared between successive invocations ofTag.doEndTag()andTag.doStartTag(). -
setId
- Overrides:
setIdin classjavax.servlet.jsp.tagext.TagSupport
-
getLogId
-
setVar
-
getVar
-
setScope
-
getScope
-
setTemplate
-
getTemplate
-
setBodyContentKey
-
getBodyContentKey
-
setCache
-
getCache
-
getVelocityView
public org.apache.velocity.tools.view.VelocityView getVelocityView() -
setVelocityView
public void setVelocityView(org.apache.velocity.tools.view.VelocityView view) -
getViewToolContext
public org.apache.velocity.tools.view.ViewToolContext getViewToolContext() -
setViewToolContext
public void setViewToolContext(org.apache.velocity.tools.view.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:
doStartTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classjavax.servlet.jsp.tagext.BodyTagSupport- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException- Specified by:
doEndTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjavax.servlet.jsp.tagext.BodyTagSupport- Throws:
javax.servlet.jsp.JspException
-
initializeView
protected void initializeView() -
hasContent
protected boolean hasContent() -
renderContent
-
getRenderedBody
-
isCached
protected boolean isCached() -
renderBody
-
evalBody
-
toScopeInt
-
cache
-
release
public void release()Release any per-instance resources, releasing any resources or state before this tag instance is disposed.- Specified by:
releasein interfacejavax.servlet.jsp.tagext.Tag- Overrides:
releasein classjavax.servlet.jsp.tagext.BodyTagSupport- See Also:
-