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.

Writing Bean Properties<br />

382<br />

Here is a bean property that maps to the value of this selectManyCheckbox example:<br />

protected String newsletters[] = new String[0];<br />

public void setNewsletters(String newsletters[]) {<br />

this.newsletters = newsletters;<br />

}<br />

public String[] getNewsletters() {<br />

return this.newsletters;<br />

}<br />

As explained in the section “Rendering Components for Selecting Multiple Values” on<br />

page 343, the UISelectItem and UISelectItems components are used to represent all the<br />

values in a UISelectMany component. See “UISelectItem Properties” on page 383 and<br />

“UISelectItems Properties” on page 383 for information on how to write the bean properties<br />

for the UISelectItem and UISelectItems components.<br />

UISelectOne Properties<br />

UISelectOne properties accept the same types as UIInput and UIOutput properties. This is<br />

because a UISelectOne component represents the single selected item from a set of items. This<br />

item can be any of the primitive types and anything else for which you can apply a converter.<br />

Here is the example selectOneMenu tag from “Displaying a Menu Using the selectOneMenu<br />

Tag” on page 342:<br />

<br />

<br />

<br />

<br />

<br />

Here is the property corresponding to this tag:<br />

protected String shippingOption = "2";<br />

public void setShippingOption(String shippingOption) {<br />

this.shippingOption = shippingOption;<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!