[ Team LiB ] Previous Section Next Section

Workshop

The Workshop is designed to help you review what you have learned and help you further increase your understanding of the material covered in this hour.

Quiz

1:

How do you tell the JSP to use a different character encoding?

2:

How can you load alternate language versions of various values at runtime?

3:

How can you display times and dates in different formats?


Answers

A1:

Use the pageEncoding attribute in the page directive.

A2:

Store the values in resource bundles and then look up the values from the bundles at runtime. Java will use the bundle for the appropriate language.

A3:

The easiest way is to use the JSTL formatting tags. Your next best alternative is to use the objects in the java.text package.


Activities

  1. Create a Web page that displays greetings based on the browser's language preference.

  2. Modify your greeting program to load its greetings from resource bundles.

    [ Team LiB ] Previous Section Next Section