Chapter 12 Examples from Java Servlet
- 12-4: Hello to Spanish speakers, with the localized
- 12-5: Hello to Japanese speakers
- 12-6: Sending localized output read from a file
- 12-7: A servlet version of the Rosetta Stone
- 12-8: A servlet version of the Tower of Babel
- 12-11 and 12-12: The hidden charset
Examples from other chapters:
- Example 12.4: Hello to Spanish speakers, with the localized time
- This servlet uses a DateFormat object to print the
current time in a format naturally understood by a
- Example 12.5: Hello to Japanese speakers
- This servlet says "Hello World" and displays the current
date and time in Japanese. For the Japanese glyphs to
display correctly in your browser requires your browser
support the Shift_JIS charset and has access to the necessary
- Example 12.6: Sending localized output read from a file
- This servlet behaves the same as Example 12-5, but it
loads the "Hello World" text from a resource bundle.
- Example 12.7: A servlet version of the Rosetta Stone
- This servlet uses the UTF-8 encoding to say "Hello
World!" and tell the current time (in the Pacific time zone) in
English, Spanish, Japanese, Chinese, Korean, and Russian.
Requires Netscape Navigator 4.0+ or Internet Explorer 4.0+.
This is my favorite servlet -- a true Hello World.
- Example 12.8: A servlet version of the Tower of Babel
- This servlet demonstrates the use of Accept-Language,
Accept-Charset, and resource bundlesto say "Hello World" to
each client in that client's own preferred language. It uses
the com.oreilly.servlet.LocaleNegotiator class to determine
which Locale, charset, and ResourceBundle should be used.
This is a close runner up for favorite servlet.
- Example 12.11 and 12.12: The hidden charset
- These servlets demonstrates how to use a hidden charset
form field to mark a form's charset so its data can be
properly decoded later. The form handler displays the
submitted data as well as its Unicode escape string. This
lets the servlet act as a web-based native charset to Unicode
string translator. They're disabled due to ISP server