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
-
Field Summary
Fields Modifier and Type Field Description protected jakarta.el.MethodExpression
afterPhase
protected jakarta.el.MethodExpression
beforePhase
protected jakarta.el.ValueExpression
locale
protected jakarta.el.ValueExpression
renderKitId
Fields inherited from class jakarta.faces.webapp.UIComponentClassicTagBase
bodyContent, pageContext, UNIQUE_ID_PREFIX
-
Constructor Summary
Constructors Constructor Description ViewTag()
-
Method Summary
Modifier and Type Method Description int
doAfterBody()
Examine the body content of this tag.int
doEndTag()
Exercise a contract with theViewHandler
to get the character encoding from the response and set it into the session.int
doStartTag()
Override parentdoStartTag()
to do the following:String
getComponentType()
Return the component type for the component that is or will be bound to this tag.protected int
getDoEndValue()
Return the flag value that should be returned from thedoEnd()
method when it is called.protected int
getDoStartValue()
Return the flag value that should be returned from thedoStart()
method when it is called.protected Locale
getLocaleFromString(String localeExpr)
Returns the locale represented by the expression.String
getRendererType()
Return therendererType
property that selects theRenderer
to be used for encoding this component, ornull
to ask the component to render itself directly.void
setAfterPhase(jakarta.el.MethodExpression newAfterPhase)
void
setBeforePhase(jakarta.el.MethodExpression newBeforePhase)
void
setLocale(jakarta.el.ValueExpression newLocale)
protected void
setProperties(UIComponent component)
Override properties and attributes of the specified component, if the corresponding properties of this tag handler instance were explicitly set.void
setRenderKitId(jakarta.el.ValueExpression renderKitId)
Methods inherited from class jakarta.faces.webapp.UIComponentELTag
createComponent, getELContext, hasBinding, release, setBinding, setRendered
Methods inherited from class jakarta.faces.webapp.UIComponentClassicTagBase
addChild, addFacet, addVerbatimAfterComponent, addVerbatimBeforeComponent, createVerbatimComponent, createVerbatimComponentFromBodyContent, doInitBody, encodeBegin, encodeChildren, encodeEnd, findComponent, getBodyContent, getComponentInstance, getCreated, getCreatedComponents, getDoAfterBodyValue, getFacesContext, getFacesJspId, getFacetName, getId, getIndexOfNextChildTag, getJspId, getParent, getParentUIComponentClassicTagBase, getPreviousOut, setBodyContent, setId, setJspId, setPageContext, setParent, setupResponseWriter
-
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
-
ViewTag
public ViewTag()
-
-
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.JspExceptionDescription 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 classUIComponentClassicTagBase
- Returns:
- the value to return from
doStart()
- Throws:
jakarta.servlet.jsp.JspException
- to causedoStart()
to throw an exception
-
doStartTag
public int doStartTag() throws jakarta.servlet.jsp.JspExceptionOverride 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 interfacejakarta.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classUIComponentClassicTagBase
- Throws:
jakarta.servlet.jsp.JspException
- if an error occurs
-
-
doAfterBody
public int doAfterBody() throws jakarta.servlet.jsp.JspExceptionExamine the body content of this tag. If it is non-
null
, non-zero length, and not an HTML comment, callUIComponentClassicTagBase.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 interfacejakarta.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in classUIComponentClassicTagBase
- Throws:
jakarta.servlet.jsp.JspException
- if an error is encountered
-
doEndTag
public int doEndTag() throws jakarta.servlet.jsp.JspExceptionExercise a contract with the
ViewHandler
to get the character encoding from the response and set it into the session.- Specified by:
doEndTag
in interfacejakarta.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classUIComponentClassicTagBase
- Throws:
jakarta.servlet.jsp.JspException
- if an error occurs
-
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 theUIComponent
instance for this tag. Subclasses must override this method to return the appropriate value.- Specified by:
getComponentType
in classUIComponentTagBase
- Returns:
- the component type
-
getRendererType
Description copied from class:UIComponentTagBase
Return the
rendererType
property that selects theRenderer
to be used for encoding this component, ornull
to ask the component to render itself directly. Subclasses must override this method to return the appropriate value.- Specified by:
getRendererType
in classUIComponentTagBase
- Returns:
- the renderer type
-
getDoEndValue
protected int getDoEndValue() throws jakarta.servlet.jsp.JspExceptionDescription 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 classUIComponentClassicTagBase
- Returns:
- the value to return from
doEnd()
- Throws:
jakarta.servlet.jsp.JspException
- to causedoEnd()
to throw an exception
-
setProperties
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 theUIComponent
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 propertiesfoo
andbar
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 therendered
property is specified for this tag handler instance.rendererType
- Set if thegetRendererType()
method returns a non-null value.
- Overrides:
setProperties
in classUIComponentELTag
- Parameters:
component
-UIComponent
whose properties are to be overridden
-
getLocaleFromString
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.
-