org.apache.struts2.views.jsp

## Class ComponentTagSupport

- java.lang.Object
- - javax.servlet.jsp.tagext.TagSupport
  - - javax.servlet.jsp.tagext.BodyTagSupport
    - - org.apache.struts2.views.jsp.StrutsBodyTagSupport
      - - org.apache.struts2.views.jsp.ComponentTagSupport

- All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag
  Direct Known Subclasses:
    AbstractUITag, ContextBeanTag, ElseIfTag, ElseTag, I18nTag, IfTag, IncludeTag, OptGroupTag, ParamTag, PropertyTag, PushTag

      public abstract class ComponentTagSupport
      extends StrutsBodyTagSupport

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Component` | `component`

    - ### Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `bodyContent`

    - ### 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
    `ComponentTagSupport()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `clearTagStateForTagPoolingServers()` Provide a mechanism to clear tag state, to handle servlet container JSP tag pooling behaviour with some servers, such as Glassfish.
    `int` | `doEndTag()`
    `int` | `doStartTag()`
    `abstract Component` | `getBean(ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)`
    `Component` | `getComponent()`
    `protected void` | `populateParams()` Define method to populate component state based on the Tag parameters.
    `protected void` | `populatePerformClearTagStateForTagPoolingServersParam()` Specialized method to populate the performClearTagStateForTagPoolingServers state of the Component to match the value set in the Tag.

    - ### Methods inherited from class org.apache.struts2.views.jsp.StrutsBodyTagSupport

      `findString, findValue, findValue, getBody, getPerformClearTagStateForTagPoolingServers, getStack, release, setPerformClearTagStateForTagPoolingServers, toString`

    - ### Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent`

    - ### 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

    - #### component

          protected Component component

  - ### Constructor Detail

    - #### ComponentTagSupport

          public ComponentTagSupport()

  - ### Method Detail

    - #### getBean

          public abstract Component getBean(ValueStack stack,
                                            javax.servlet.http.HttpServletRequest req,
                                            javax.servlet.http.HttpServletResponse res)

    - #### doEndTag

          public int doEndTag()
                       throws javax.servlet.jsp.JspException

      Specified by:
        `doEndTag` in interface `javax.servlet.jsp.tagext.Tag`
      Overrides:
        `doEndTag` in class `StrutsBodyTagSupport`
      Throws:
        `javax.servlet.jsp.JspException`

    - #### doStartTag

          public int doStartTag()
                         throws javax.servlet.jsp.JspException

      Specified by:
        `doStartTag` in interface `javax.servlet.jsp.tagext.Tag`
      Overrides:
        `doStartTag` in class `javax.servlet.jsp.tagext.BodyTagSupport`
      Throws:
        `javax.servlet.jsp.JspException`

    - #### populateParams

          protected void populateParams()

      Define method to populate component state based on the Tag parameters.

      Descendants should override this method for custom behaviour, but should always call the ancestor method when doing so.

    - #### populatePerformClearTagStateForTagPoolingServersParam

          protected void populatePerformClearTagStateForTagPoolingServersParam()

      Specialized method to populate the performClearTagStateForTagPoolingServers state of the Component to match the value set in the Tag.

      Generally only unit tests would call this method directly, to avoid calling the whole populateParams() chain again after doStartTag() has been called. Doing that can break tag / component state behaviour, but unit tests still need a way to set the performClearTagStateForTagPoolingServers state for the component (which only comes into being after doStartTag() is called).

    - #### getComponent

          public Component getComponent()

    - #### clearTagStateForTagPoolingServers

          protected void clearTagStateForTagPoolingServers()

      Description copied from class: `StrutsBodyTagSupport`
      Provide a mechanism to clear tag state, to handle servlet container JSP tag pooling behaviour with some servers, such as Glassfish.

      Usage: Override this method in descendant classes to clear any state that might cause issues should the servlet container re-use a cached instance of the tag object. If the descendant class does not declare any new field members then it should not be strictly necessary to call this method there. Typically that means calling the ancestor's `clearTagStateForTagPoolingServers()` method first, then resetting instance variables at the current level to their default state.

      Note: If the descendant overrides `StrutsBodyTagSupport.doEndTag()`, and does not call super.doEndTag(), then the descendant should call this method in the descendant doEndTag() method to ensure consistent clearing of tag state.

      Overrides:
        `clearTagStateForTagPoolingServers` in class `StrutsBodyTagSupport`

Copyright © 2000–2024 Apache Software Foundation. All rights reserved.