1.

Create a JSP page that will display the operating system name, architecture, and version the server is running.


Answer:


2.

Create a JSP page that uses a SimpleDateFormat to display the current date. Use the following format:

Sunday, June 9, 2002


Answer:


3.

Create a JSP page that uses a JavaBean to print out a simple text calendar for the current month.

Sample page output:

__________________________________________________

The current month:
              June 2002
                         
         S M T W T F S
         -------------------
                           1
         2 3 4 5 6 7 8
         9 10 11 12 13 14 15
        16 17 18 19 20 21 22
        23 24 25 26 27 28 29
        30


Answer:


4.

Create a JSP page that uses a JavaBean to display a random "fortune."

Create a list of ten fortunes. When a user opens the page, display a random fortune.

Sample output:
__________________________________________________

The Virtual Fortune Cookie
Your fortune: A short stranger will soon enter your life.
__________________________________________________


Answer:


5.

Create a JSP page that allows a user to enter a month and year and then uses a JavaBean to print out a simple text calendar for that month and year.
Sample page output:
__________________________________________________

Your selected month:

             March 1970

        S M T W T F S
        -------------------
        1 2 3 4 5 6 7
        8 9 10 11 12 13 14
       15 16 17 18 19 20 21
       22 23 24 25 26 27 28
       29 30 31
__________________________________________________


Answer:


6.

Create a JSP page that uses a JavaBean to compute the amount of time a user has been alive.

Create a page that allows a user to enter his birth date. Allow the option of entering his time of birth. Use a JavaBean to calculate the number of years, months, and days the user has been alive. If the user enters a time, also calculate the number of hours and minutes the user has been alive. Sample output:

          You have lived for 32 years, 2 months, 15 days, 12 hours, and 5 minutes.


Answer:


7.

Create an HTML form that allows a user to design a pizza, and sends the information to a JavaBean to calculate and display the price of the pizza.

Use a minimum of three different HTML field types to allow a user to select different components of a pizza. Various options include pizza size, crust type, sauce style, cheeses, and toppings. In a JavaBean, assign a price to each option and use the prices in the JavaBean to calculate the total cost of the pizza once the user submits the information. Use the JavaBean to display the final version of the pizza and its cost.


Answer:


8.

Create a JSP page that uses a JavaBean to display multiple random "fortunes."

Create a list of ten fortunes. When a user opens the page, display a random fortune. Add an Again button to display a new fortune when pressed.

Sample output:
__________________________________________________

The Virtual Fortune Cookie
Your fortune: That wasn't chicken you just ate.


Answer:


9.

Use error checking in your JSP calendar page.

Create a JSP page that allows a user to enter a month and year, and then uses a JavaBean to print out a simple text calendar for that month and year.

If the values entered for the month or year are invalid, show an appropriate message and allow the user to fix the error.


Answer:


10.

Create a JSP page that allows a user to enter a month and year and generates an HTML table representing that month and year.

Separate presentation from computation by using two JavaBeans. Create one JavaBean to accept the month and year, the return value representing the first day of the month offset, and the number of days in the month. (For example, for July 1994, below, the first day of the month falls on a Friday, so the offset would be 6.)

Create a second JavaBean to generate an HTML table from this information. Use the nonbreaking space character   to fill in blank days in the table.

Sample page output:
__________________________________________________

Your selected month:

July 1994







S

M

T

W

T

F

S

 

 

 

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

__________________________________________________


Answer:


11.

Use session tracking to maintain a list of pizzas ordered by a user on a session.

Use a minimum of three different HTML field types to allow a user to select different components of a pizza. Various options include pizza size, crust type, sauce style, cheeses, and toppings. In a JavaBean, assign a price to each option and use the prices in the bean to calculate the total cost of the pizza once the user submits the information. Use the JavaBean to display the final version of the pizza and its cost.

Maintain a list of ordered pizzas and their prices. Display the list whenever a user orders a new pizza.


Answer:


12.

Change your session pizza ordering program so that each ordered pizza is prefixed by a checkbox. Add a "Delete checked" button that deletes all pizzas that the user has checked.


Answer:


13.

Extend the improved session pizza order program so that all pizzas chosen by the user are remembered on the next login.


Answer:


14.

Use a servlet to implement a virtual fortune cookie

Create a list of ten fortunes. When a user opens the page, display a random fortune.

Sample output:

__________________________________________________

The Virtual Fortune Cookie
Your fortune: Too much coding has hygienic consequences.
__________________________________________________


Answer:


15.

Create a servlet that generates an HTML table representing a month and year chosen by a user.
Sample page output:
__________________________________________________

Your selected month:

July 1994







S

M

T

W

T

F

S

 

 

 

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30



Answer: