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.

<strong>The</strong> value attribute of the selectOneMenu tag maps to the property that holds the currently<br />

selected item’s value. You are not required to provide a value for the currently selected item. If<br />

you don’t provide a value, the first item in the list is selected by default.<br />

Like the selectOneRadio tag, the selectOneMenu tag must contain either a selectItems tag or<br />

a set of selectItem tags for representing the items in the list. “<strong>The</strong> UISelectItem,<br />

UISelectItems, and UISelectItemGroup Components” on page 344 explains these tags.<br />

Rendering Components for Selecting MultipleValues<br />

In some cases, you need to allow your users to select multiple values rather than just one value<br />

from a list of choices. You can do this using one of the following kinds of components:<br />

■ A set of check boxes<br />

■ A drop-down menu<br />

■ A list box<br />

Figure 11–5 shows examples of these components.<br />

FIGURE 11–5 Example Select Many Components<br />

Adding UI Components to a Page Using the HTML ComponentTags<br />

<strong>The</strong> UISelectMany class defines a component that allows the user to select zero or more values<br />

from a set of values. This component can be rendered as a set of check boxes, a list box, or a<br />

menu. This section explains the selectManyCheckbox tag. <strong>The</strong> selectManyListbox tag and<br />

selectManyMenu tag are written in a similar way.<br />

A list box differs from a menu in that it displays a subset of items in a box, whereas a menu<br />

displays only one item at a time when the user is not selecting the menu. <strong>The</strong> size attribute of<br />

the selectManyListbox tag determines the number of items displayed at one time. <strong>The</strong> list box<br />

includes a scroll bar for scrolling through any remaining items in the list.<br />

Chapter 11 • Using <strong>Java</strong>Server FacesTechnology in JSP Pages 343

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

Saved successfully!

Ooh no, something went wrong!