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 />

148<br />

<strong>The</strong> unified EL also allows custom tag developers to specify which of the following kinds of<br />

expressions that a custom tag attribute will accept:<br />

■ Immediate evaluation expressions or deferred evaluation expressions. An immediate<br />

evaluation expression is evaluated immediately by the JSP engine. A deferred evaluation<br />

expression can be evaluated later by the underlying technology using the expression<br />

language.<br />

■ Value expression or method expression. A value expression references data, whereas a<br />

method expression invokes a method.<br />

■ Rvalue expression or Lvalue expression. An rvalue expression can only read a value, whereas<br />

an lvalue expression can both read and write that value to an external object.<br />

Finally, the unified EL also provides a pluggable API for resolving expressions so that<br />

application developers can implement their own resolvers that can handle expressions not<br />

already supported by the unified EL.<br />

This section gives an overview of the unified expression language features by explaining the<br />

following topics:<br />

■ “Immediate and Deferred Evaluation Syntax” on page 148<br />

■ “Value and Method Expressions” on page 150<br />

■ “Defining a Tag Attribute Type” on page 155<br />

■ “Deactivating Expression Evaluation” on page 156<br />

■ “Literal Expressions” on page 158<br />

■ “Resolving Expressions” on page 159<br />

■ “Implicit Objects” on page 161<br />

■ “Operators” on page 162<br />

■ “Reserved Words” on page 162<br />

■ “Examples of EL Expressions” on page 163<br />

■ “Functions” on page 164<br />

Immediate and Deferred Evaluation Syntax<br />

<strong>The</strong> unified EL supports both immediate and deferred evaluation of expressions. Immediate<br />

evaluation means that the JSP engine evaluates the expression and returns the result<br />

immediately when the page is first rendered. Deferred evaluation means that the technology<br />

using the expression language can employ its own machinery to evaluate the expression<br />

sometime later during the page’s life cycle, whenever it is appropriate to do so.<br />

Those expressions that are evaluated immediately use the ${} syntax, which was introduced<br />

with the JSP 2.0 expression language. Expressions whose evaluation is deferred use the #{}<br />

syntax, which was introduced by <strong>Java</strong>Server Faces technology.<br />

Because of its multiphase life cycle, <strong>Java</strong>Server Faces technology uses deferred evaluation<br />

expressions. During the life cycle, component events are handled, data is validated, and other<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!