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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

...<br />

<br />

As explained in “<strong>The</strong> Life Cycle of a JSP Page” on page 142, JSP supports a simple<br />

request/response life cycle, during which a page is executed and the HTML markup is rendered<br />

immediately. <strong>The</strong>refore, the simple, read-only expression language offered by JSP 2.0 was well<br />

suited to the needs of JSP applications.<br />

<strong>Java</strong>Server Faces technology, on the other hand, features a multiphase life cycle designed to<br />

support its sophisticated UI component model, which allows for converting and validating<br />

component data, propagating component data to objects, and handling component events. To<br />

facilitate these functions, <strong>Java</strong>Server Faces technology introduced its own expression language<br />

that included the following functionality:<br />

■ Deferred evaluation of expressions<br />

■ <strong>The</strong> ability to set data as well as get data<br />

■ <strong>The</strong> ability to invoke methods<br />

See “Using the Unified EL to Reference Backing Beans” on page 310 for more information on<br />

how to use the unified EL in <strong>Java</strong>Server Faces applications.<br />

<strong>The</strong>se two expression languages have been unified for a couple reasons. One reason is so that<br />

page authors can mix JSP content with <strong>Java</strong>Server Faces tags without worrying about conflicts<br />

caused by the different life cycles these technologies support. Another reason is so that other<br />

JSP-based technologies could make use of the additional features similarly to the way <strong>Java</strong>Server<br />

Faces technology uses them. In fact, although the standard JSP tags and static content continue<br />

to use only those features present in JSP 2.0, authors of JSP custom tags can create tags that take<br />

advantage of the new set of features in the unified expression language.<br />

To summarize, the new, unified expression language allows page authors to use simple<br />

expressions to perform the following tasks:<br />

■ Dynamically read application data stored in <strong>Java</strong>Beans components, various data structures,<br />

and implicit objects<br />

■ Dynamically write data, such as user input into forms, to <strong>Java</strong>Beans components<br />

■ Invoke arbitrary static and public methods<br />

■ Dynamically perform arithmetic operations<br />

Unified Expression Language<br />

Chapter 5 • <strong>Java</strong>Server PagesTechnology 147

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

Saved successfully!

Ooh no, something went wrong!