Servlets.com

Home

What's New?

com.oreilly.servlet

Servlet Polls

Mailing Lists

Servlet Engines

Servlet ISPs

Servlet Tools

Documentation

Online Articles

The Soapbox

"Java Servlet
Programming,
Second Edition"

"Java Enterprise
Best Practices"

Speaking & Slides

About Jason

XQuery Affiliate

Advertising Info

The Book
Chapter 13 Examples from Java Servlet Programming, 2nd Ed

  • 13-4: Hello to Spanish speakers, with the localized time
  • 13-5: Hello to Japanese speakers
  • 13-6: Sending localized output read from a file
  • 13-7: A servlet version of the Rosetta Stone
  • 13-8: A servlet version of the Tower of Babel
  • 13-11 and 13-12: The hidden charset

Examples from other chapters:

Example 13.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 Spanish-speaking recipient.

Example 13.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 fonts.

Example 13.6: Sending localized output read from a file
This servlet behaves the same as Example 13-5, but it loads the "Hello World" text from a resource bundle.

Example 13.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 13.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. (You can set your preferred language in Internet Explorer using Tools/View | Internet Options | General | Languages and in Netscape using Edit | Preferences | Navigator | Languages.) The servlet 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 13.11 and 13.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 classpath issues.

 


Home   com.oreilly.servlet   Polls   Lists   
Engines   ISPs   Tools   Docs   Articles   Soapbox   Book

Copyright © 1999-2005 Jason Hunter
Privacy Policy

webmaster@servlets.com
Last updated: March 1, 2009