Stage 2 · Topic 2 - JSP · Session 6: JSP Expression Language
${ expression } <%-- directly in the page --%>
<%= expression %> <%-- inside an expression tag --%>
attribute="<%= expression %>" <%-- inside a tag attribute --%>
attribute="${ expression }" <%-- same, preferred when EL is on --%>
| Object | Fetches |
|---|---|
pageScope | the attribute associated with the page object |
requestScope | the attribute associated with the request object |
sessionScope | the attribute associated with the session object |
applicationScope | the attribute associated with the application object |
param | the single value of a request parameter |
paramValues | the array of values of a request parameter |
header | the single value of a request header |
headerValues | the array of values of a request header |
cookie | the value of a cookie |
initParam | a context parameter from web.xml |
pageContext | the JSP pageContext object |
| Purpose | Symbolic | Word form |
|---|---|---|
| multiply, divide, remainder | * / % | div mod |
| add, subtract | + - | — |
| less than / greater than | < > <= >= | lt gt le ge |
| equal, not equal | == != | eq ne |
| and, or, not | && || ! | and or not |
| empty test, type test | — | empty instanceof |
| conditional | ?: | — |
| index / named lookup | [] . | — |
Precedence, highest first: [] () →
- not ! empty → * / div % mod →
+ - → < <= > >= lt le gt ge →
== != eq ne → && and →
|| or → ?:
eq ne lt le gt ge true false and or not instanceof div mod empty null
jsp:setProperty or
<c:set> to change something.${ nmae } prints an empty
string, not an error. Check your spelling.