JavaSercer Pages 11.2 Generating Localized Output Now that (Php5 web hosting)
JavaSercer Pages 11.2 Generating Localized Output Now that you have an understanding of the type of internationalization support Java provides, let’s look at a concrete example. But instead of using the internationalization classes directly in the pages, let’s use a set of custom actions based on these classes. Using custom actions minimizes the need for Java code in the JSP pages, making it easier for page authors to develop an internationalized site. The example application, briefly described in the introduction to this chapter, lets visitors voice their opinions by selecting one of the answers to a question, as well as seeing how others have answered. The text, numbers, and dates are available in three different languages. Figure 11.1 shows all pages used in this application and how they are related. Figure 11.1. Localized poll application pages The first page the user sees is the poll.jsp page, shown in Figure 11.2. The language used to display the contents the first time this page is displayed is based on the Accept-Language header value in the request. The top part of the page contains radio buttons for the three supported languages and a Submit button. If the user wants the application to be presented in another language, he or she selects the corresponding radio button and clicks Submit, causing the page to be requested again, this time with a language parameter included in the request. The value of the language parameter is then used to display the page in the selected language. Information about the selected language is saved as session data, so it’s available to all the other application pages. Figure 11.2. The language selection and question page page 152
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra j2ee hosting services