Giving users the ability to select a language ensures that the user gets the content that they expect. Applications can also automatically deliver localized content by using Accept-Language attribute in header information of the HTTP request and mapping it to a supported locale. The Accept-Language attribute is set in the user's Web browser and differs slightly between browsers. When using automatic application-level locale selection, it is prudent to also provide a mechanism to let the user override the automatic selection and select a preferred language. Automatic locale selection also depends on application support for different locales.
Care needs to be taken to ensure that unsupported languages are handled properly.
The Java programming language provides facilities for localization. This section discusses methods of providing localized data in a Web application. In some cases an application may need to support multiple languages on the same JSP page. List resource bundles are also useful when using servlets. Code Example 4.5 shows how to deliver content from a user-specified locale using a ListResourceBundle .