com.opensymphony.oscache.web.tag
Class UseCachedTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.opensymphony.oscache.web.tag.UseCachedTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, Serializable, javax.servlet.jsp.tagext.Tag

public class UseCachedTag
extends javax.servlet.jsp.tagext.TagSupport

UseCachedTag is a tag that tells a <cache> tag to reuse the cached body.

Usage Example:


       <%@ taglib uri="oscache" prefix="cache" %>
       <cache:cache key="mycache" scope="application">
                if (reuse cached)
                        <cache:usecached />
                else
                        some other logic
       </cache:cache>
 
Note this is very useful with try / catch blocks so that you can still produce old cached data if an exception occurs, eg your database goes down.

Version:
$Revision: 1.1 $
Author:
Mike Cannon-Brookes
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
UseCachedTag()
           
 
Method Summary
 int doStartTag()
          The start tag.
 void setUse(boolean value)
          Set the decision to use the body content of the ancestor <cache> or not.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UseCachedTag

public UseCachedTag()
Method Detail

setUse

public void setUse(boolean value)
Set the decision to use the body content of the ancestor <cache> or not.

Parameters:
value - Whether or not to use the body content. Default is true.

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspTagException
The start tag.

Returns:
The standard Tag return.
Throws:
javax.servlet.jsp.JspTagException - The standard tag exception thrown.

OSCache Project Page