- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- All Implemented Interfaces:
- Serializable, BodyTag, IterationTag, JspTag, Tag
public class BodyTagSupport extends TagSupport implements BodyTag
A base class for defining tag handlers implementing BodyTag.The BodyTagSupport class implements the BodyTag interface and adds additional convenience methods including getter methods for the bodyContent property and methods to get at the previous out JspWriter.
Many tag handlers will extend BodyTagSupport and only redefine a few methods.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description protected BodyContent
bodyContent
The current BodyContent for this BodyTag.-
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
-
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
-
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
Constructors Constructor and Description BodyTagSupport()
Default constructor, all subclasses are required to only define a public constructor with the same signature, and to call the superclass constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description int
doAfterBody()
After the body evaluation: do not reevaluate and continue with the page.int
doEndTag()
Default processing of the end tag returning EVAL_PAGE.void
doInitBody()
Prepare for evaluation of the body just before the first body evaluation: no action.int
doStartTag()
Default processing of the start tag returning EVAL_BODY_BUFFERED.BodyContent
getBodyContent()
Get current bodyContent.JspWriter
getPreviousOut()
Get surrounding out JspWriter.void
release()
Release state.void
setBodyContent(BodyContent b)
Prepare for evaluation of the body: stash the bodyContent away.-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
-
-
-
-
Field Detail
-
bodyContent
protected BodyContent bodyContent
The current BodyContent for this BodyTag.
-
-
Constructor Detail
-
BodyTagSupport
public BodyTagSupport()
Default constructor, all subclasses are required to only define a public constructor with the same signature, and to call the superclass constructor. This constructor is called by the code generated by the JSP translator.
-
-
Method Detail
-
doStartTag
public int doStartTag() throws JspException
Default processing of the start tag returning EVAL_BODY_BUFFERED.- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Returns:
- EVAL_BODY_BUFFERED
- Throws:
JspException
- if an error occurred while processing this tag- See Also:
Tag.doStartTag()
-
doEndTag
public int doEndTag() throws JspException
Default processing of the end tag returning EVAL_PAGE.- Specified by:
doEndTag
in interfaceTag
- Overrides:
doEndTag
in classTagSupport
- Returns:
- EVAL_PAGE
- Throws:
JspException
- if an error occurred while processing this tag- See Also:
Tag.doEndTag()
-
setBodyContent
public void setBodyContent(BodyContent b)
Prepare for evaluation of the body: stash the bodyContent away.- Specified by:
setBodyContent
in interfaceBodyTag
- Parameters:
b
- the BodyContent- See Also:
doAfterBody()
,doInitBody()
,BodyTag.setBodyContent(javax.servlet.jsp.tagext.BodyContent)
-
doInitBody
public void doInitBody() throws JspException
Prepare for evaluation of the body just before the first body evaluation: no action.- Specified by:
doInitBody
in interfaceBodyTag
- Throws:
JspException
- if an error occurred while processing this tag- See Also:
setBodyContent(javax.servlet.jsp.tagext.BodyContent)
,doAfterBody()
,BodyTag.doInitBody()
-
doAfterBody
public int doAfterBody() throws JspException
After the body evaluation: do not reevaluate and continue with the page. By default nothing is done with the bodyContent data (if any).- Specified by:
doAfterBody
in interfaceIterationTag
- Overrides:
doAfterBody
in classTagSupport
- Returns:
- SKIP_BODY
- Throws:
JspException
- if an error occurred while processing this tag- See Also:
doInitBody()
,IterationTag.doAfterBody()
-
release
public void release()
Release state.- Specified by:
release
in interfaceTag
- Overrides:
release
in classTagSupport
- See Also:
Tag.release()
-
getBodyContent
public BodyContent getBodyContent()
Get current bodyContent.- Returns:
- the body content.
-
getPreviousOut
public JspWriter getPreviousOut()
Get surrounding out JspWriter.- Returns:
- the enclosing JspWriter, from the bodyContent.
-
-
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 15:09:21 Cette version de la page est en cache (à la date du 21/08/2025 15:09:21) 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/BodyTagSupport.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
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.