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.

Binding ComponentValues and Instances to External Data Sources<br />

364<br />

application <br />

<br />

shape<br />

poly<br />

<br />

<br />

alt<br />

NAmerica<br />

<br />

...<br />

<br />

This example configures a bean called NA, which has several properties, one of which is called<br />

shape.<br />

Although the area tags on the chooselocale.jsp page do not bind to an ImageArea property<br />

(they bind to the bean itself), to do this, you refer to the property using a value expression from<br />

the value attribute of the component’s tag:<br />

<br />

Much of the time you will not include definitions for a managed bean’s properties when<br />

configuring it. You need to define a property and its value only when you want the property to<br />

be initialized with a value when the bean is initialized.<br />

If a component tag’s value attribute must refer to a property that is not initialized in the<br />

managed-bean configuration, the part of the value-binding expression after the period must<br />

match the property name as it is defined in the backing bean.<br />

See “Application Configuration Resource File” on page 435 for information on how to configure<br />

beans in the application configuration resource file.<br />

“Writing Bean Properties” on page 377 explains in more detail how to write the backing bean<br />

properties for each of the component types.<br />

Binding a ComponentValue to an Implicit Object<br />

One external data source that a value attribute can refer to is an implicit object.<br />

<strong>The</strong> bookreceipt.jsp page of the Duke’s Bookstore application includes a reference to an<br />

implicit object from a parameter substitution tag:<br />

<br />

<br />

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