javax.servlet.jsp.tagext
Class BodyContent

java.lang.Object
  |
  +--java.io.Writer
        |
        +--javax.servlet.jsp.JspWriter
              |
              +--javax.servlet.jsp.tagext.BodyContent
Direct Known Subclasses:
QBodyContent

public abstract class BodyContent
extends JspWriter

BodyContent subclasses JspWriter to accumulate the contents of a BodyTag. The JSP engine is responsible for creating BodyContent objects; tags just use them. A BodyTag will generally grab the contents in its doAfterBody:

 void doAfterBody() throws JspException
 {
   BodyContent body = getBodyContent();
   JspWriter out = body.getEnclosingWriter();
   try {
     body.writeOut(out);
   } catch (IOException e) {
     throw new JspException(String.valueOf(e));
   }
 }
 


Fields inherited from class javax.servlet.jsp.JspWriter
autoFlush, bufferSize, DEFAULT_BUFFER, NO_BUFFER, UNBOUNDED_BUFFER
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
protected BodyContent(JspWriter prevOut)
          Creates a new BodyContent with prevOut as its enclosing writer.
 
Method Summary
abstract  void clearBody()
          Clears the contents of a body tag.
 void flush()
          Flush does nothing for a bodyContent.
 JspWriter getEnclosingWriter()
          Returns the encloding writer.
abstract  java.io.Reader getReader()
          Returns a Reader for accessing the contents of a body tag.
abstract  java.lang.String getString()
          Returns a String representing the contents of a body tag.
abstract  void writeOut(java.io.Writer out)
          Writes the contents to the writer.
 
Methods inherited from class javax.servlet.jsp.JspWriter
clear, clearBuffer, getBufferSize, getRemaining, isAutoFlush, newLine, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println
 
Methods inherited from class java.io.Writer
close, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BodyContent

protected BodyContent(JspWriter prevOut)
Creates a new BodyContent with prevOut as its enclosing writer.
Parameters:
prevOut - the enclosing writer.
Method Detail

getEnclosingWriter

public JspWriter getEnclosingWriter()
Returns the encloding writer. For top-level tags, this will be the JSP page's out. For child tags, this will be the parent's bodyContent.

flush

public void flush()
           throws java.io.IOException
Flush does nothing for a bodyContent.
Overrides:
flush in class JspWriter

clearBody

public abstract void clearBody()
Clears the contents of a body tag.

getReader

public abstract java.io.Reader getReader()
Returns a Reader for accessing the contents of a body tag.

getString

public abstract java.lang.String getString()
Returns a String representing the contents of a body tag.

writeOut

public abstract void writeOut(java.io.Writer out)
                       throws java.io.IOException
Writes the contents to the writer.
Parameters:
out - the destination writer .