Going Global (Part 2)
Part 1 of Going Global briefly outlines the steps required to get up and running with the JSTL library. It also presents simple code stubs necessary to localize JSP pages. But in order to internationalize an entire Web-based application, you need more than one or two line examples; you need practical samples. More importantly, you must be aware of common pitfalls that most developers face. So let's start off with resource bundles.
Resource Bundles
To localize your Web application, you need to create a property file that contains all of the strings that you want to display on your JSP pages. This file, which must be stored in your Web application archive under WEB-INF/classes, contains a list of key/value pairs such as demonstrated in the next example:
# This is my default resource bundle called "system.properties"
heading.title = Welcome to
application.name = The Online Bookstore
instructions = Please enter criteria to begin your search.
criteria.name = Name:
criteria.isbn = ISBN Number:
button.search = Search
button.clear = Clear
The default file created above represents the catch-all language. This file is only used when the language specific file is not found, or when keys are missing from the language specific file.
How you can instruct JSTL as to which file represents English and which represents another language? By appending its name with a
Please log in or sign up below to read the rest of the article.
|
"A mind once stretched by a new idea never regains its original dimensions." - Anonymous |




