Saturday 5 September 2015

What are JSP EL implicit objects and how it’s different from JSP implicit Objects?

JSP Expression Language provides many implicit objects that we can use to get attributes from different scopes and parameter values. Note that these are different from JSP implicit objects and contains only the attributes in given scope. The only common implicit object in JSP EL and JSP page is pageContext object.
Below table provides list of implicit object in JSP EL.
JSP EL Implicit ObjectsTypeDescription
pageScopeMapA map that contains the attributes set with page scope.
requestScopeMapUsed to get the attribute value with request scope.
sessionScopeMapUsed to get the attribute value with session scope.
applicationScopeMapUsed to get the attributes value from application scope.
paramMapUsed to get the request parameter value, returns a single value
paramValuesMapUsed to get the request param values in an array, useful when request parameter contain multiple values.
headerMapUsed to get request header information.
headerValuesMapUsed to get header values in an array.
cookieMapUsed to get the cookie value in the JSP
initParamMapUsed to get the context init params, we can’t use it for servlet init params
pageContextpageContextSame as JSP implicit pageContext object, used to get the request, session references etc. example usage is getting request HTTP Method name.

No comments:

Post a Comment