Class JspViewHandlingStrategy
public class JspViewHandlingStrategy extends ViewHandlingStrategy
ViewHandlingStrategy
handles JSP-based views.-
Field Summary
Fields inherited from class com.sun.faces.application.view.ViewHandlingStrategy
associate, webConfig
Fields inherited from class jakarta.faces.view.ViewDeclarationLanguage
FACELETS_VIEW_DECLARATION_LANGUAGE_ID, JSP_VIEW_DECLARATION_LANGUAGE_ID
-
Constructor Summary
Constructors Constructor Description JspViewHandlingStrategy()
-
Method Summary
Modifier and Type Method Description void
buildView(FacesContext context, UIViewRoot view)
Take any actions specific to this VDL implementation to cause the argumentUIViewRoot
which must have been created via a call toViewDeclarationLanguage.createView(jakarta.faces.context.FacesContext, java.lang.String)
, to be populated with children.BeanInfo
getComponentMetadata(FacesContext context, Resource componentResource)
Not supported in JSP-based views.String
getId()
Returns a non-null String that can be used to identify this view declaration language.Resource
getScriptComponentResource(FacesContext context, Resource componentResource)
Not supported in JSP-based views.StateManagementStrategy
getStateManagementStrategy(FacesContext context, String viewId)
For implementations that want to control the implementation of state saving and restoring, theStateManagementStrategy
allows them to do so.ViewMetadata
getViewMetadata(FacesContext context, String viewId)
Not supported in JSP-based views.Stream<String>
getViews(FacesContext context, String path, int maxDepth, ViewVisitOption... options)
Not supported in JSP-based views.Stream<String>
getViews(FacesContext context, String path, ViewVisitOption... options)
Not supported in JSP-based views.boolean
handlesViewId(String viewId)
ThisViewHandlingStrategy
should be the last one queried and as such we returntrue
.void
renderView(FacesContext context, UIViewRoot view)
Render a view rooted at argumentview
.Methods inherited from class com.sun.faces.application.view.ViewHandlingStrategy
createView, restoreView
Methods inherited from class jakarta.faces.view.ViewDeclarationLanguage
calculateResourceLibraryContracts, createComponent, retargetAttachedObjects, retargetMethodExpressions, viewExists
-
Constructor Details
-
JspViewHandlingStrategy
public JspViewHandlingStrategy()
-
-
Method Details
-
getViewMetadata
Not supported in JSP-based views.
- Specified by:
getViewMetadata
in classViewDeclarationLanguage
- Parameters:
context
- TheFacesContext
for this request.viewId
- the view id from which to extract the metadata- Returns:
- the view metadata
- See Also:
ViewDeclarationLanguage.getViewMetadata(jakarta.faces.context.FacesContext, String)
-
buildView
Description copied from class:ViewDeclarationLanguage
Take any actions specific to this VDL implementation to cause the argument
UIViewRoot
which must have been created via a call toViewDeclarationLanguage.createView(jakarta.faces.context.FacesContext, java.lang.String)
, to be populated with children.The Facelets implementation must insure that markup comprising the view must be executed, with the
UIComponent
instances in the view being encountered in the same depth-first order as in other lifecycle methods defined onUIComponent
, and added to the view (but not rendered) during the traversal. The runtime must guarantee that the view must be fully populated before any of the following happen.-
The
PhaseListener.afterPhase(jakarta.faces.event.PhaseEvent)
method of anyPhaseListener
s attached to the application is called -
The
UIViewRoot
phase listener installed viaUIViewRoot.setAfterPhaseListener(jakarta.el.MethodExpression)
orUIViewRoot.addPhaseListener(jakarta.faces.event.PhaseListener)
are called.
If the
root
is already populated with children, the view must still be re-built, but care must be taken to ensure that the existing components are correctly paired up with their VDL counterparts in the VDL page. Also, any system events that would normally be generated during the adding or removing of components from the view must be temporarily disabled during the creation of the view and then re-enabled when the view has been built.- Specified by:
buildView
in classViewDeclarationLanguage
- Parameters:
context
-view
-- Throws:
IOException
- See Also:
ViewDeclarationLanguage.buildView(jakarta.faces.context.FacesContext, jakarta.faces.component.UIViewRoot)
-
-
renderView
Description copied from class:ViewDeclarationLanguage
Render a view rooted at argument
view
. See section JSF.7.7.2 for the specification of the default implementation.- Specified by:
renderView
in classViewDeclarationLanguage
- Parameters:
context
- theFacesContext
for this request.view
- theUIViewRoot
from an early call toViewDeclarationLanguage.createView(jakarta.faces.context.FacesContext, java.lang.String)
orViewDeclarationLanguage.restoreView(jakarta.faces.context.FacesContext, java.lang.String)
.- Throws:
IOException
- if the view cannot be rendered for any reason- See Also:
ViewDeclarationLanguage.renderView(jakarta.faces.context.FacesContext, jakarta.faces.component.UIViewRoot)
-
getStateManagementStrategy
Description copied from class:ViewDeclarationLanguage
For implementations that want to control the implementation of state saving and restoring, the
StateManagementStrategy
allows them to do so. Returningnull
indicates that the implementation wishes the runtime to handle the state saving and restoring. Implementations that provide the VDL for Facelets for Jakarta Server Faces 2.0 and later must return non-null
from this method.- Specified by:
getStateManagementStrategy
in classViewDeclarationLanguage
- Parameters:
context
- theFacesContext
for the current request.viewId
- the view id.- Returns:
- the strategy as specified above
-
getComponentMetadata
Not supported in JSP-based views.
- Specified by:
getComponentMetadata
in classViewDeclarationLanguage
- Parameters:
context
- TheFacesContext
for this request.componentResource
- TheResource
that represents the component.- Returns:
- the component metadata
- See Also:
ViewDeclarationLanguage.getComponentMetadata(jakarta.faces.context.FacesContext, jakarta.faces.application.Resource)
-
getScriptComponentResource
Not supported in JSP-based views.
- Specified by:
getScriptComponentResource
in classViewDeclarationLanguage
- Parameters:
context
- TheFacesContext
for this request.componentResource
- TheResource
that represents the component.- Returns:
- the
Resource
corresponding to the argumentcomponentResource
- See Also:
ViewDeclarationLanguage.getScriptComponentResource(jakarta.faces.context.FacesContext, jakarta.faces.application.Resource)
-
getViews
Not supported in JSP-based views.
- Overrides:
getViews
in classViewDeclarationLanguage
- Parameters:
context
- TheFacesContext
for this request.path
- The initial path from which to start looking for viewsoptions
- The options to influence the traversal. SeeViewVisitOption
for details on those.- Returns:
- the
Stream
of view ids - See Also:
ViewDeclarationLanguage.getViews(FacesContext, String, ViewVisitOption...)
-
getViews
public Stream<String> getViews(FacesContext context, String path, int maxDepth, ViewVisitOption... options)Not supported in JSP-based views.
- Overrides:
getViews
in classViewDeclarationLanguage
- Parameters:
context
- TheFacesContext
for this request.path
- The initial path from which to start looking for viewsmaxDepth
- The absolute maximum depth of nested directories to visit counted from the root (/
).options
- The options to influence the traversal. SeeViewVisitOption
for details on those.- Returns:
- the
Stream
of view ids - See Also:
ViewDeclarationLanguage.getViews(FacesContext, String, int, ViewVisitOption...)
-
handlesViewId
ThisViewHandlingStrategy
should be the last one queried and as such we returntrue
.- Specified by:
handlesViewId
in classViewHandlingStrategy
- Parameters:
viewId
- the view ID- Returns:
true
if thisViewHandlingStrategy
handles the the view type represented byviewId
- See Also:
ViewHandlingStrategy.handlesViewId(String)
-
getId
Description copied from class:ViewDeclarationLanguage
Returns a non-null String that can be used to identify this view declaration language.
The default implementation returns the fully qualified class name of the view declaration language implementation. Subclasses may override to provide a more meaningful id.
- Overrides:
getId
in classViewDeclarationLanguage
- Returns:
- the id of this view declaration language
-