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.

Setting Up a Page<br />

322<br />

<strong>The</strong> form tag is nested inside of the view tag. As its name suggests, the form tag represents a<br />

form, which is submitted when a button or hyperlink on the page is clicked. For the data of<br />

other components on the page to be submitted with the form, the tags representing the<br />

components must be nested inside the form tag. See “Adding a Form Component” on page 327<br />

for more details on using the form tag.<br />

If you want to include a page containing <strong>Java</strong>Server Faces tags within another JSP page that<br />

includes <strong>Java</strong>Server Faces tags, you must enclose the entire nested page in a subview tag. You<br />

can add the subview tag on the parent page and nest a jsp:include inside it to include the page:<br />

<br />

<br />

<br />

You can also include the subview tag inside the nested page, but it must enclose all the<br />

<strong>Java</strong>Server Faces tags on the nested page.<br />

<strong>The</strong> subview tag has two optional attributes: binding and rendered. <strong>The</strong> binding attribute<br />

binds to a component that implements NamingContainer. One potential use case of binding a<br />

subview component to a bean is if you want to dynamically add components to the subview in<br />

the backing bean.<br />

<strong>The</strong> rendered attribute can be set to true or false, indicating whether or not the components<br />

nested in the subview tag should be rendered.<br />

In summary, a typical JSP page that uses <strong>Java</strong>Server Faces tags will look somewhat like this:<br />

<br />

<br />

<br />

<br />

other <strong>Java</strong>Server Faces tags and core tags,<br />

including one or more button or hyperlink components for<br />

submitting the form<br />

<br />

<br />

<strong>The</strong> sections “Using the Core Tags” on page 323 and “Adding UI Components to a Page Using<br />

the HTML Component Tags” on page 325 describe how to use the core tags from the <strong>Java</strong>Server<br />

Faces core tag library and the component tags from the <strong>Java</strong>Server Faces standard HTML<br />

render kit tag library.<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!