Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.servlet.jsp.tagext
Class BodyContent

    java.lang.Object
      java.io.Writer
          javax.servlet.jsp.JspWriter
              javax.servlet.jsp.tagext.BodyContent

public abstract class BodyContent
extends JspWriter

An encapsulation of the evaluation of the body of an action so it is available to a tag handler. BodyContent is a subclass of JspWriter.

Note that the content of BodyContent is the result of evaluation, so it will not contain actions and the like, but the result of their invocation.

BodyContent has methods to convert its contents into a String, to read its contents, and to clear the contents.

The buffer size of a BodyContent object is unbounded. A BodyContent object cannot be in autoFlush mode. It is not possible to invoke flush on a BodyContent object, as there is no backing stream.

Instances of BodyContent are created by invoking the pushBody and popBody methods of the PageContext class. A BodyContent is enclosed within another JspWriter (maybe another BodyContent object) following the structure of their associated actions.

A BodyContent is made available to a BodyTag through a setBodyContent() call. The tag handler can use the object until after the call to doEndTag().

Field Summary

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 e)` Protected constructor.

Method Summary
`void` | `clearBody()` Clear the body without throwing any exceptions.
`void` | `flush()` Redefined flush() so it is not legal.
`JspWriter` | `getEnclosingWriter()` Get the enclosing JspWriter.
`abstract java.io.Reader` | `getReader()` Return the value of this BodyContent as a Reader.
`abstract java.lang.String` | `getString()` Return the value of the BodyContent as a String.
`abstract void` | `writeOut(java.io.Writer out)` Write the contents of this BodyContent into a Writer.

Methods inherited from class javax.servlet.jsp.JspWriter
`clear, clearBuffer, close, 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
`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 e)

  Protected constructor. Unbounded buffer, no autoflushing.

Parameters:
  `e` - the enclosing JspWriter

Method Detail

### flush

    public void flush()
               throws java.io.IOException

  Redefined flush() so it is not legal.

  It is not valid to flush a BodyContent because there is no backing stream behind it.

  Specified by:
    `flush` in class `JspWriter`
  Throws:
    `java.io.IOException` - always thrown

### clearBody

    public void clearBody()

  Clear the body without throwing any exceptions.

### getReader

    public abstract java.io.Reader getReader()

  Return the value of this BodyContent as a Reader.

  Returns:
    the value of this BodyContent as a Reader

### getString

    public abstract java.lang.String getString()

  Return the value of the BodyContent as a String.

  Returns:
    the value of the BodyContent as a String

### writeOut

    public abstract void writeOut(java.io.Writer out)
                           throws java.io.IOException

  Write the contents of this BodyContent into a Writer. Subclasses may optimize common invocation patterns.

  Parameters:
    `out` - The writer into which to place the contents of this body evaluation
  Throws:
    `java.io.IOException` - if an I/O error occurred while writing the contents of this BodyContent to the given Writer

### getEnclosingWriter

    public JspWriter getEnclosingWriter()

  Get the enclosing JspWriter.

  Returns:
    the enclosing JspWriter passed at construction time

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.