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).
Modifier and Type | Field and Description |
---|---|
protected String |
bodyContentKey |
protected ViewToolContext |
context |
static String |
DEFAULT_BODY_CONTENT_KEY |
protected org.apache.velocity.runtime.resource.util.StringResourceRepository |
repository |
protected String |
scope |
protected String |
template |
protected String |
var |
protected VelocityView |
view |
Constructor and Description |
---|
VelocityViewTag() |
Modifier and Type | Method and Description |
---|---|
protected void |
cache(String name,
String template) |
int |
doEndTag() |
int |
doStartTag() |
protected void |
evalBody(Writer out) |
String |
getBodyContentKey() |
String |
getCache() |
protected String |
getLogId() |
protected String |
getRenderedBody() |
org.apache.velocity.runtime.resource.util.StringResourceRepository |
getRepository() |
String |
getScope() |
String |
getTemplate() |
String |
getVar() |
VelocityView |
getVelocityView() |
ViewToolContext |
getViewToolContext() |
protected boolean |
hasContent() |
protected void |
initializeView() |
protected boolean |
isCached() |
void |
release()
Release any per-instance resources, releasing any resources or state
before this tag instance is disposed.
|
protected void |
renderBody(Writer out) |
protected void |
renderContent(Writer out) |
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() . |
void |
setBodyContentKey(String key) |
void |
setCache(String s) |
void |
setId(String id) |
void |
setRepository(org.apache.velocity.runtime.resource.util.StringResourceRepository repo) |
void |
setScope(String scope) |
void |
setTemplate(String template) |
void |
setVar(String var) |
void |
setVelocityView(VelocityView view) |
void |
setViewToolContext(ViewToolContext context) |
protected static int |
toScopeInt(String scope) |
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue
public static final String DEFAULT_BODY_CONTENT_KEY
protected transient VelocityView view
protected transient ViewToolContext context
protected transient org.apache.velocity.runtime.resource.util.StringResourceRepository repository
protected String var
protected String scope
protected String template
protected String bodyContentKey
protected void reset()
Tag.doEndTag()
and
Tag.doStartTag()
.public void setId(String id)
setId
in class javax.servlet.jsp.tagext.TagSupport
protected String getLogId()
public void setVar(String var)
public String getVar()
public void setScope(String scope)
public String getScope()
public void setTemplate(String template)
public String getTemplate()
public void setBodyContentKey(String key)
public String getBodyContentKey()
public void setCache(String s)
public String getCache()
public VelocityView getVelocityView()
public void setVelocityView(VelocityView view)
public ViewToolContext getViewToolContext()
public void setViewToolContext(ViewToolContext context)
public org.apache.velocity.runtime.resource.util.StringResourceRepository getRepository()
public void setRepository(org.apache.velocity.runtime.resource.util.StringResourceRepository repo)
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
protected void initializeView()
protected boolean hasContent()
protected boolean isCached()
protected static int toScopeInt(String scope)
public void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.BodyTagSupport
Tag.release()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.