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.

Unlike nearly every other <strong>Java</strong>Server Faces tag attribute, the rendered attribute is restricted to<br />

using rvalue expressions. As explained in “Unified Expression Language” on page 146, rvalue<br />

expressions can only read data; they cannot write the data back to the data source. <strong>The</strong>refore,<br />

expressions used with rendered attributes can use the arithmetic operators and literals that<br />

rvalue expressions can use but lvalue expressions cannot use. For example, the expression in the<br />

preceding example uses the > operator.<br />

<strong>The</strong> style and styleClass Attributes<br />

<strong>The</strong> style and styleClass attributes allow you to specify Cascading Style Sheets (CSS) styles<br />

for the rendered output of your component tags. “Displaying Error Messages with the message<br />

and messages Tags” on page 347 describes an example of using the style attribute to specify<br />

styles directly in the attribute. A component tag can instead refer to a CSS stylesheet class. <strong>The</strong><br />

dataTable tag on the bookcatalog.jsp page of the Duke’s Bookstore application references the<br />

style class list-background:<br />

<br />

<strong>The</strong> stylesheet that defines this class is stylesheet.css, which is included in the application.<br />

For more information on defining styles, please the see Cascading Style Sheets Specification at<br />

http://www.w3.org/Style/CSS/.<br />

<strong>The</strong> value and binding Attributes<br />

A tag representing a component defined by UIOutput or a subclass of UIOutput uses value and<br />

binding attributes to bind its component’s value or instance respectively to an external data<br />

source. “Binding Component Values and Instances to External Data Sources” on page 362<br />

explains how to use these attributes.<br />

Adding a Form Component<br />

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

A UIForm component class represents an input form, which includes child components that<br />

contain data that is either presented to the user or submitted with the form.<br />

Figure 11–1 shows a typical login form, in which a user enters a user name and password, and<br />

submits the form by clicking the Login button.<br />

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

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

Saved successfully!

Ooh no, something went wrong!