Warming Up
|
1. |
Create a JSF page that uses a bean to display a random number between 1000 and 9999. Use the following format:
Today's lucky
number is 1729. What is the code of your bean class? |
|
2. |
What are the contents of your index.jsp file? Note: your file can have a different name. |
|
3. |
What are the contents of your web.xml file? |
|
4. |
What are the contents of your faces-config.xml file? |
|
5. |
Describe the directory structure of your application. |
A Simple JSF Program
|
6. |
Create a JSP page that uses a JavaBean to display a random "fortune." What is the code of your bean class(es)? |
|
7. |
What are the contents of your *.jsp file(s)? |
Interacting with the User
|
8. |
Create a JSF page that allows a user to enter a category for the fortune that they want to have displayed. Categories might include
Sample output: __________________________________________________ The Virtual Fortune Cookie Your fortune: That wasn't chicken you just ate. __________________________________________________ What is the code of your bean class(es)? |
|
10. |
Create a JSF page that allows a user to enter a category for the
fortune that they want to have displayed. Use a text field for the
category. If
the user entered an unknown category, show an appropriate message. If
the user entered a known category, show a fortune cookie. Both pages
should have a "Back" button that returns to the original page. What is the code of your bean class(es)? |
|
11. |
What are the contents of your *.jsp file(s)? |
|
12. |
In what file did you include your navigation rules? How did you define them? |
Database Connectivity
|
13. |
For a more robust program, we want to store the
fortunes and their categories in a database. Modify the bean code so that it looks up fortunes in a database table. What is
the code of your bean class(es)? (You should not modify the JSF pages.) |
|
14. |
Give a SQL script that populates the database table. |
|
15. |
What error
message do you get when a user connects to your JSF application when
the database server is not running? |