Learn Java for Web Development

(Tina Meador) #1
CHAPTER 3: Best Practices in Java EE Web Development 123

EL Implicit Objects

Scriptlets have access to several JSP implicit objects, as explained in Chapter 2. These objects
allow access to any variables that are held in the particular JSP scopes. EL also provides its own
implicit objects called EL implicit objects. EL implicit objects are not the same as JSP implicit objects
(except for pageContext). All of these EL Implicit objects are Maps that map the respective scope
attribute names to their values. For instance, using the implicit objects param and paramValues, it is
possible to access HTTP request parameters. Table 3-3 describes the EL implicit objects.


Table 3-3. Implicit Objects in EL


Implicit Object Description

cookie Map: maps cookie names to a single Cookie object.
header Map: contains the values of each header name
headerValues Map: maps a header name to a string array of all possible values for the header.
initParam Map: maps context initialization parameter names to their string parameter values.
param Map: contains the names of the parameters to a page.
paramValues Map: maps a parameter nameto a string array of all the values for the parameter.
pageContext The PageContext object.
applicationScope Map: contains all application-scoped variables.
pageScope Map: contains all page-scoped variables.
requestScope Map: contains all request-scoped variables.
sessionScope Map: contains all session-scoped variables.

Figure 3-7. Comparing scriptlets, standard actions, and EL

Free download pdf