javax.servlet.jsp.tagext

Class BodyContent

  • All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable

    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().

    • 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 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 interface Flushable
        Specified by:
        flush in class JspWriter
        Throws:
        IOException - always thrown
      • clearBody

        public void clearBody()
        Clear the body without throwing any exceptions.
      • getReader

        public abstract Reader getReader()
        Return the value of this BodyContent as a Reader.
        Returns:
        the value of this BodyContent as a Reader
      • getString

        public abstract 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(Writer out)
                               throws 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:
        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

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 16:53:47 Cette version de la page est en cache (à la date du 21/08/2025 16:53:47) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 24/12/2007, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/servlet/jsp/tagext/bodycontent.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, BodyContent

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.