com.taggercat.tags
Class CacheContentTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.taggercat.tags.CacheContentTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

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

This tags caches provides very simple caching of its body content onto the specified scope variable. The body content is also sent to the output stream.

<tc:cacheContent var="actionBar" > your content to cache </tc:cacheContent> Later in your page you can print the content directly from the cache using: <tc:out value="pageScope.actionBar" escapeXml="false" /> Note that this tag is equivalent to: <c:set var="cachedFragment" scope="page"> ... </c:set> and then: ${cachedFragment}

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
CacheContentTag()
           
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 int doStartTag()
           
 void setScope(java.lang.String scope)
          Sets the scope the attribute will be saved under.
 void setVar(java.lang.String varName)
          Sets the attribute name the results will be saved under.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

CacheContentTag

public CacheContentTag()
Method Detail

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

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody 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

setScope

public void setScope(java.lang.String scope)
Sets the scope the attribute will be saved under.

Parameters:
scope - sets the scope attribute of the tag The scope can be one of:

  • page - default if not specified
  • session
  • request
  • application

setVar

public void setVar(java.lang.String varName)
Sets the attribute name the results will be saved under.

Parameters:
varName - the name in the 'var' attribute of the tag