19.09.2015 Views

Prentice.Hall.Introduction.to.Java.Programming,.Brief.Version.9th.(2014).[sharethefiles.com]

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

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

Figure 44.12<br />

The resources folder was created.<br />

<br />

JSF provides h:panelGrid and h:panelGroup elements <strong>to</strong> contain and layout<br />

subelements. h:panelGrid places the elements in a grid like the <strong>Java</strong><br />

grid layout manager. h:panelGrid places the elements like a <strong>Java</strong> GUI<br />

flow layout manager. Lines 18-25 places six elements (labels and input<br />

texts) are in a h:panelGrid. The columns attribute specifies that each<br />

row in the grid has 6 columns. The elements are placed in<strong>to</strong> a row from<br />

left <strong>to</strong> right in the order they appear in the facelet. When a row is<br />

full, a new row is created <strong>to</strong> hold the elements. We used h:panelGrid in<br />

this example. You may replace it with h:panelGroup <strong>to</strong> see how the<br />

elements would be arranged.<br />

<br />

You may use the style attribute with a JSF html tag <strong>to</strong> specify the CSS<br />

style for the element and its subelements. The style attribute in line 8<br />

specifies color green for all elements in this h:panelGrid element.<br />

<br />

The h:outputLabel element is for displaying a label (line 19). You can<br />

use the value attribute <strong>to</strong> specify the lable’s text.<br />

<br />

The h:inputText element is for displaying a text input box for the user<br />

<strong>to</strong> enter a text (line 20). The id attribute is useful for other elements<br />

or the server program <strong>to</strong> reference this element.<br />

<br />

The h:selectOneRadio element is for displaying a group of radio but<strong>to</strong>ns<br />

(line 30). Each radio but<strong>to</strong>n is defined using an f:selectItem element<br />

(lines 31-34).<br />

<br />

The h:selectOneMenu element is for displaying a <strong>com</strong>bo box (line 41).<br />

Each item in the <strong>com</strong>bo box is defined using an f:selectItem element<br />

(lines 42-43).<br />

<br />

The h:selectManyListbox element is for displaying a list for the user <strong>to</strong><br />

choose multiple items in a list (line 46). Each item in the list is<br />

defined using an f:selectItem element (lines 47-49).<br />

<br />

14

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

Saved successfully!

Ooh no, something went wrong!