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.

FIGURE 11–6 An Example List Box Created Using SelectItemGroup Instances<br />

<strong>The</strong> selectItem tag represents a UISelectItem component. <strong>The</strong> selectItems tag represents a<br />

UISelectItems component. You can use either a set of selectItem tags or a single<br />

selectItems tag within your selectOne or selectMany tag.<br />

<strong>The</strong> advantages of using the selectItems tag are as follows:<br />

■ You can represent the items using different data structures, including Array, Map and<br />

Collection. <strong>The</strong> data structure is composed of SelectItem instances or SelectItemGroup<br />

instances.<br />

■ You can concatenate different lists together into a single UISelectMany or UISelectOne<br />

component and group the lists within the component, as shown in Figure 11–6.<br />

■ You can dynamically generate values at runtime.<br />

<strong>The</strong> advantages of using selectItem are as follows:<br />

■ <strong>The</strong> page author can define the items in the list from the page.<br />

■ You have less code to write in the bean for the selectItem properties.<br />

For more information on writing component properties for the UISelectItems components,<br />

see “Writing Bean Properties” on page 377. <strong>The</strong> rest of this section shows you how to use the<br />

selectItems and selectItem tags.<br />

Using the selectItems Tag<br />

Here is the selectManyCheckbox tag from the section “Rendering Components for Selecting<br />

Multiple Values” on page 343:<br />

<br />

<br />

<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!