- java.lang.Object
-
- java.io.Writer
-
- javax.servlet.jsp.JspWriter
-
- javax.servlet.jsp.tagext.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().
-
-
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
Constructors Modifier Constructor and Description protected
BodyContent(JspWriter e)
Protected constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description 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 Reader
getReader()
Return the value of this BodyContent as a Reader.abstract String
getString()
Return the value of the BodyContent as a String.abstract void
writeOut(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
-
-
-
-
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 interfaceFlushable
- Specified by:
flush
in classJspWriter
- 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
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/servlet/jsp/tagext/bodycontent.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.