10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Unified Expression Language<br />

162<br />

expression ${product}, the resolver will look for product in the page, request, session, and<br />

application scopes and will return its value. If product is not found, null is returned.<br />

When an expression references one of the implicit objects by name, the appropriate object is<br />

returned instead of the corresponding attribute. For example, ${pageContext} returns the<br />

PageContext object, even if there is an existing pageContext attribute containing some other<br />

value.<br />

Operators<br />

In addition to the . and [] operators discussed in “Value and Method Expressions” on<br />

page 150, the JSP expression language provides the following operators, which can be used in<br />

rvalue expressions only:<br />

■ Arithmetic: +, - (binary), *, / and div, % and mod, - (unary)<br />

■ Logical: and, &&, or, ||, not, !<br />

■ Relational: ==, eq, !=, ne, , gt, =, le. Comparisons can be made against other<br />

values, or against boolean, string, integer, or floating point literals.<br />

■ Empty: <strong>The</strong> empty operator is a prefix operation that can be used to determine whether a<br />

value is null or empty.<br />

■ Conditional: A?B:C. Evaluate B or C, depending on the result of the evaluation of A.<br />

<strong>The</strong> precedence of operators highest to lowest, left to right is as follows:<br />

■ [] .<br />

■ () (used to change the precedence of operators)<br />

■ - (unary) not ! empty<br />

■ * / div % mod<br />

■ +-(binary)<br />

■ =ltgtlege<br />

■ == != eq ne<br />

■ && and<br />

■ || or<br />

■ ?:<br />

ReservedWords<br />

<strong>The</strong> following words are reserved for the JSP expression language and should not be used as<br />

identifiers.<br />

and or not eq<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!