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.

You can display current time by invoking the getTime() method in a<br />

TimeBean object using a JSF expression.<br />

To keep index.xhtml intact, we create a new JSF page named<br />

CurrentTime.xhtml as follows:<br />

Step 1. Right-click the jsf2demo node in the project pane <strong>to</strong> display a<br />

context menu and choose New, JSF Page <strong>to</strong> display the New JSF File dialog<br />

box, as shown in Figure 44.9.<br />

Step 2. Enter CurrentTime in the File Name field, choose Facelets and<br />

click Finish <strong>to</strong> generate CurrentTime.xhmtl, as shown in Figure 44.10.<br />

Step 3. Add a JSF expression <strong>to</strong> obtain the current time, as shown in<br />

Listing 44.3.<br />

Figure 44.9<br />

The New JSF File dialog is used <strong>to</strong> create a JSF page.<br />

Figure 44.10<br />

A New JSF page CurrentTime was created.<br />

Listing 44.3 CurrentTime.xhtml<br />

<br />

<br />

<br />

9

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

Saved successfully!

Ooh no, something went wrong!