Java Reference
In-Depth Information
5.
In JSF, the facelets are the view for presenting data. Data are obtained from Java objects.
Objects are defined using Java classes.
6.
In JSF, the objects that are accessed from a facelet are JavaBeans objects.
7.
The JSF expression can either use the property name or invoke the method to obtain the
current time.
8.
JSF provides many elements for displaying GUI components. The tags with the h prefix
are in the JSF HTML Tag library. The tags with the f prefix are in the JSF Core Tag
library.
9.
You can specify the JavaBeans objects at the application scope, session scope, view
scope, or request scope.
10.
The view scope keeps the bean alive as long as you stay on the view. The view scope is
between session and request scopes.
11.
JSF provides several convenient and powerful ways for input validation. You can use
the standard validator tags in the JSF Core Tag Library or create custom validators.
Q UIZ
Answer the quiz for this chapter online at www.cs.armstrong.edu/liang/intro10e/quiz.html .
P ROGRAMMING E XERCISES
*33.1
( Factorial table in JSF ) Write a JSF page that displays a factorial page as
shown in Figure 33.25. Display the table in an h:outputText component. Set
its escape property to false to display it as HTML contents.
*33.2
( Multiplication table ) Write a JSF page that displays a multiplication table as
shown in Figure 33.26.
*33.3
( Calculate tax ) Write a JSF page to let the user enter taxable income and filing
status, as shown in Figure 33.27a. Clicking the Compute Tax button computes
and displays the tax, as shown in Figure 33.27b. Use the computeTax method
introduced in Listing 3.5, ComputeTax.java, to compute tax.
*33.4
( Calculate loan ) Write a JSF page that lets the user enter loan amount, interest
rate, and number of years, as shown in Figure 33.28a. Click the Compute Loan
Payment button to compute and display the monthly and total loan payments,
as shown in Figure 33.28b. Use the Loan class given in Listing 10.2, Loan.java,
to compute the monthly and total payments.
*33.5
( Addition quiz ) Write a JSF program that generates addition quizzes randomly,
as shown in Figure 33.29a. After the user answers all questions, it displays the
result, as shown in Figure 33.29b.
*33.6
( Large factorial ) Rewrite Exercise 33.1 to handle large factorial. Use the
BigInteger class introduced in Section 10.9.
*33.7
( Guess birthday ) Listing 4.3, GuessBirthday.java, gives a program for guessing
a birthday. Write a JSF program that displays five sets of numbers, as shown in
Figure 33.30a. After the user checks the appropriate boxes and clicks the Guess
Birthday button, the program displays the birthday, as shown in Figure 33.30b.
 
 
Search WWH ::




Custom Search