- java.lang.Object
-
- javax.servlet.jsp.tagext.SimpleTagSupport
-
public class SimpleTagSupport extends Object implements SimpleTag
A base class for defining tag handlers implementing SimpleTag.The SimpleTagSupport class is a utility class intended to be used as the base class for new simple tag handlers. The SimpleTagSupport class implements the SimpleTag interface and adds additional convenience methods including getter methods for the properties in SimpleTag.
- Since:
- JSP 2.0
-
-
Constructor Summary
Constructors Constructor and Description SimpleTagSupport()
Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
doTag()
Default processing of the tag does nothing.static JspTag
findAncestorWithClass(JspTag from, Class<?> klass)
Find the instance of a given class type that is closest to a given instance.protected JspFragment
getJspBody()
Returns the body passed in by the container via setJspBody.protected JspContext
getJspContext()
Returns the page context passed in by the container via setJspContext.JspTag
getParent()
Returns the parent of this tag, for collaboration purposes.void
setJspBody(JspFragment jspBody)
Stores the provided JspFragment.void
setJspContext(JspContext pc)
Stores the provided JSP context in the private jspContext field.void
setParent(JspTag parent)
Sets the parent of this tag, for collaboration purposes.
-
-
-
Constructor Detail
-
SimpleTagSupport
public SimpleTagSupport()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Detail
-
doTag
public void doTag() throws JspException, IOException
Default processing of the tag does nothing.- Specified by:
doTag
in interfaceSimpleTag
- Throws:
JspException
- Subclasses can throw JspException to indicate an error occurred while processing this tag.SkipPageException
- If the page that (either directly or indirectly) invoked this tag is to cease evaluation. A Simple Tag Handler generated from a tag file must throw this exception if an invoked Classic Tag Handler returned SKIP_PAGE or if an invoked Simple Tag Handler threw SkipPageException or if an invoked Jsp Fragment threw a SkipPageException.IOException
- Subclasses can throw IOException if there was an error writing to the output stream- See Also:
SimpleTag.doTag()
-
setParent
public void setParent(JspTag parent)
Sets the parent of this tag, for collaboration purposes.The container invokes this method only if this tag invocation is nested within another tag invocation.
-
getParent
public JspTag getParent()
Returns the parent of this tag, for collaboration purposes.
-
setJspContext
public void setJspContext(JspContext pc)
Stores the provided JSP context in the private jspContext field. Subclasses can access theJspContext
viagetJspContext()
.- Specified by:
setJspContext
in interfaceSimpleTag
- Parameters:
pc
- the page context for this invocation- See Also:
SimpleTag.setJspContext(javax.servlet.jsp.JspContext)
-
getJspContext
protected JspContext getJspContext()
Returns the page context passed in by the container via setJspContext.- Returns:
- the page context for this invocation
-
setJspBody
public void setJspBody(JspFragment jspBody)
Stores the provided JspFragment.- Specified by:
setJspBody
in interfaceSimpleTag
- Parameters:
jspBody
- The fragment encapsulating the body of this tag. If the action element is empty in the page, this method is not called at all.- See Also:
SimpleTag.setJspBody(javax.servlet.jsp.tagext.JspFragment)
-
getJspBody
protected JspFragment getJspBody()
Returns the body passed in by the container via setJspBody.- Returns:
- the fragment encapsulating the body of this tag, or null if the action element is empty in the page.
-
findAncestorWithClass
public static final JspTag findAncestorWithClass(JspTag from, Class<?> klass)
Find the instance of a given class type that is closest to a given instance. This method uses the getParent method from the Tag and/or SimpleTag interfaces. This method is used for coordination among cooperating tags.For every instance of TagAdapter encountered while traversing the ancestors, the tag handler returned by TagAdapter.getAdaptee() - instead of the TagAdpater itself - is compared to klass. If the tag handler matches, it - and not its TagAdapter - is returned.
The current version of the specification only provides one formal way of indicating the observable type of a tag handler: its tag handler implementation class, described in the tag-class subelement of the tag element. This is extended in an informal manner by allowing the tag library author to indicate in the description subelement an observable type. The type should be a subtype of the tag handler implementation class or void. This addititional constraint can be exploited by a specialized container that knows about that specific tag library, as in the case of the JSP standard tag library.
When a tag library author provides information on the observable type of a tag handler, client programmatic code should adhere to that constraint. Specifically, the Class passed to findAncestorWithClass should be a subtype of the observable type.
- Parameters:
from
- The instance from where to start looking.klass
- The subclass of JspTag or interface to be matched- Returns:
- the nearest ancestor that implements the interface or is an instance of the class specified
-
-
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 18:33:56 Cette version de la page est en cache (à la date du 21/08/2025 18:33:56) 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/simpletagsupport.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.