Nearby lessons
13 of 30JSP - EL Implicit Objects
📌 What You Will Learn
- Know all 11 EL implicit objects
- Use param, header, cookie, initParam objects
- Use scope objects to access attributes in specific scopes
EL Implicit Objects give you access to request parameters, headers, cookies, scope attributes, and the page context — all through simple map-like syntax in EL expressions.
All 11 EL Implicit Objects
| Object | Type | Purpose |
|---|---|---|
pageScope | Map | Attributes in page scope |
requestScope | Map | Attributes in request scope |
sessionScope | Map | Attributes in session scope |
applicationScope | Map | Attributes in application scope |
param | Map | Request parameters (single values) |
paramValues | Map | Request parameters (String[] arrays) |
header | Map | Request headers (single values) |
headerValues | Map | Request headers (String[] arrays) |
cookie | Map | Cookies associated with the request |
initParam | Map | Context initialization parameters from web.xml |
pageContext | PageContext | Access all JSP implicit objects (the only non-Map) |
Scope Objects
Use scope objects to retrieve attributes from a specific scope:
Example02
Scope Search Order
When you write ${x} without a scope prefix, the container searches in order:
- Page scope
- Request scope
- Session scope
- Application scope
This is exactly the same as pageContext.findAttribute("x").
Example03
param and paramValues
| Object | Equivalent Servlet Method | Returns |
|---|---|---|
param | request.getParameter() | Single String value |
paramValues | request.getParameterValues() | String[] array |
Example04
header and headerValues
Same as param/paramValues but for request headers:
Example05
cookie
Access cookies from the request:
Example06
initParam
Access context parameters declared in web.xml:
Example07
pageContext — Accessing JSP Objects
pageContext is the only non-Map EL implicit object. Use it to access JSP implicit objects:
Example08
📝 Key Takeaways
- EL has 11 implicit objects — most are Maps
- pageContext is the only non-Map EL implicit object
- EL handles null and ArrayIndexOutOfBoundsException gracefully
🧠 Test Your Knowledge
3 QuestionsProgress: 0 / 3