Class ViewTag

All Implemented Interfaces:
jakarta.servlet.jsp.tagext.BodyTag, jakarta.servlet.jsp.tagext.IterationTag, jakarta.servlet.jsp.tagext.JspIdConsumer, jakarta.servlet.jsp.tagext.JspTag, jakarta.servlet.jsp.tagext.Tag

public class ViewTag
extends UIComponentELTag
All Faces component tags must be nested within a f:view tag. This tag corresponds to the root of the UIComponent tree. It does not have a Renderer. It exists mainly to provide a guarantee that all faces components reside inside of this tag.
  • Field Details

    • renderKitId

      protected jakarta.el.ValueExpression renderKitId
    • locale

      protected jakarta.el.ValueExpression locale
    • beforePhase

      protected jakarta.el.MethodExpression beforePhase
    • afterPhase

      protected jakarta.el.MethodExpression afterPhase
  • Constructor Details

  • Method Details

    • setRenderKitId

      public void setRenderKitId​(jakarta.el.ValueExpression renderKitId)
    • setLocale

      public void setLocale​(jakarta.el.ValueExpression newLocale)
    • setBeforePhase

      public void setBeforePhase​(jakarta.el.MethodExpression newBeforePhase)
    • setAfterPhase

      public void setAfterPhase​(jakarta.el.MethodExpression newAfterPhase)
    • getDoStartValue

      protected int getDoStartValue() throws jakarta.servlet.jsp.JspException
      Description copied from class: UIComponentClassicTagBase

      Return the flag value that should be returned from the doStart() method when it is called. Subclasses may override this method to return the appropriate value.

      Overrides:
      getDoStartValue in class UIComponentClassicTagBase
      Returns:
      the value to return from doStart()
      Throws:
      jakarta.servlet.jsp.JspException - to cause doStart() to throw an exception
    • doStartTag

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

      Override parent doStartTag() to do the following:

      • Reflect the response object for a method called flushContentToWrappedResponse and invoke it. This causes any content that appears before the view to be written out to the response. This is necessary to allow proper ordering to happen.

      Specified by:
      doStartTag in interface jakarta.servlet.jsp.tagext.Tag
      Overrides:
      doStartTag in class UIComponentClassicTagBase
      Throws:
      jakarta.servlet.jsp.JspException - if an error occurs
    • doAfterBody

      public int doAfterBody() throws jakarta.servlet.jsp.JspException

      Examine the body content of this tag. If it is non-null, non-zero length, and not an HTML comment, call UIComponentClassicTagBase.createVerbatimComponent().

      Set the value of the verbatim component to be content.

      Add this child to the end of the child list for UIViewRoot.

      Specified by:
      doAfterBody in interface jakarta.servlet.jsp.tagext.IterationTag
      Overrides:
      doAfterBody in class UIComponentClassicTagBase
      Throws:
      jakarta.servlet.jsp.JspException - if an error is encountered
    • doEndTag

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

      Exercise a contract with the ViewHandler to get the character encoding from the response and set it into the session.

      Specified by:
      doEndTag in interface jakarta.servlet.jsp.tagext.Tag
      Overrides:
      doEndTag in class UIComponentClassicTagBase
      Throws:
      jakarta.servlet.jsp.JspException - if an error occurs
    • getComponentType

      public String getComponentType()
      Description copied from class: UIComponentTagBase

      Return the component type for the component that is or will be bound to this tag. This value can be passed to Application.createComponent(java.lang.String) to create the UIComponent instance for this tag. Subclasses must override this method to return the appropriate value.

      Specified by:
      getComponentType in class UIComponentTagBase
      Returns:
      the component type
    • getRendererType

      public String getRendererType()
      Description copied from class: UIComponentTagBase

      Return the rendererType property that selects the Renderer to be used for encoding this component, or null to ask the component to render itself directly. Subclasses must override this method to return the appropriate value.

      Specified by:
      getRendererType in class UIComponentTagBase
      Returns:
      the renderer type
    • getDoEndValue

      protected int getDoEndValue() throws jakarta.servlet.jsp.JspException
      Description copied from class: UIComponentClassicTagBase

      Return the flag value that should be returned from the doEnd() method when it is called. Subclasses may override this method to return the appropriate value.

      Overrides:
      getDoEndValue in class UIComponentClassicTagBase
      Returns:
      the value to return from doEnd()
      Throws:
      jakarta.servlet.jsp.JspException - to cause doEnd() to throw an exception
    • setProperties

      protected void setProperties​(UIComponent component)
      Description copied from class: UIComponentELTag

      Override properties and attributes of the specified component, if the corresponding properties of this tag handler instance were explicitly set. This method must be called ONLY if the specified UIComponent was in fact created during the execution of this tag handler instance, and this call will occur BEFORE the UIComponent is added to the view.

      Tag subclasses that want to support additional set properties must ensure that the base class setProperties() method is still called. A typical implementation that supports extra properties foo and bar would look something like this:

       protected void setProperties(UIComponent component) {
           super.setProperties(component);
           if (foo != null) {
               component.setAttribute("foo", foo);
           }
           if (bar != null) {
               component.setAttribute("bar", bar);
           }
       }
       

      The default implementation overrides the following properties:

      • rendered - Set if a value for the rendered property is specified for this tag handler instance.
      • rendererType - Set if the getRendererType() method returns a non-null value.
      Overrides:
      setProperties in class UIComponentELTag
      Parameters:
      component - UIComponent whose properties are to be overridden
    • getLocaleFromString

      protected Locale getLocaleFromString​(String localeExpr)
      Returns the locale represented by the expression.
      Parameters:
      localeExpr - a String in the format specified by JSTL Specification as follows: "A String value is interpreted as the printable representation of a locale, which must contain a two-letter (lower-case) language code (as defined by ISO-639), and may contain a two-letter (upper-case) country code (as defined by ISO-3166). Language and country codes must be separated by hyphen (???-???) or underscore (???_???)."
      Returns:
      Locale instance cosntructed from the expression.