Binding Component Value to an Implicit Object
JSF provides list of implicit objects. These objects can be referred in value attribute of component in the JSP page.
Implicit Object | Description |
applicationScope | Represents a Map of application scope attribute values with attribute names as keys |
cookie | Represents a Map of cookie values for the current request with cookie names as keys |
facesContext | Represents the FacesContext instance for the current request |
header | Represents a Map of HTTP header values for the current request with header names as keys |
headerValues | Represents a Map
of String arrays containing all the header
values for HTTP headers in the current request with header names as keys |
initParam | Represents a Map
of the context initialization parameters |
param | Represents a Map
of the request parameters for this request with parameter names as keys |
paramValues | Represents a Map
of String arrays containing all the parameter
values for request parameters in the current request with parameter names
as keys |
requestScope | Represents a Map
of the request attributes for this request with attribute names as keys |
sessionScope | Represents a Map
of the session attributes for this request with attribute names as keys |
view | Represents The root
UIComponent
in the current component tree stored in the FacesRequest
for this request |
For example:
Session Scoped parameter can be accessed as below:
<h:outputFormat value="Session Scope Value Is: {0}" rendered="#{!(sessionScope.username==null)}"> <f:param value="#{sessionScope.username}"/> </h:outputFormat> |
Request Scoped parameter can be accessed as below:
<h:outputFormat value="Request Scope Value Is: {0}"
rendered="#{!(requestScope.value==null)}"> <f:param value="#{requestScope.value}"/> </h:outputFormat> |