When we use JSP to design a site for different countries, in particular, there is no special difference between the interface, we can use some mechanisms of JSP to support internationalization.
There are usually three ways to achieve internationalization
Write a set of JSP code for each country, you can reuse some logical code by embedding the bean and the tag processor. Maintain unified JSP code, directly using Java resource bundling mechanism to internationalize. Maintain a unified JSP code, realize internationalization using a general purpose or custom marker library. We focus on the third approach because it has good flexibility, maintainability and scalability.
Its actual marker is also using Java's resource bundling mechanism, just makes it easier to use the internationally used method package, and more conforms to JSP programming ideas to separate the expression and logic layers. The general tag library is more famous with Jakarta I18N tag library.
The foundation of JSP is the foundation of Java, which uses resource bundled mechanisms to separate resources and code, and automatically match the corresponding resources by reading the corresponding Locale information, and implement text, time, date on this basis. Internationalization of currency, digital and other formats. See the JavaTM Tutorial Internationalization on the basic concepts and methods of Java internationalization.
But there are still many different processes and specific methods of the internationalization of Java programs. Mainly in the source of Locale information: JSP Locale information from most cases from the browser, and the general Java program is mostly from the current JVM.
Important with JSP's tag library mechanism: By using generic or user-defined I18N tag libraries, you can have good flexibility, maintainability, and scalability. But you need to configure the tag library on the server side.
The most important difference between JSP Internationalization and General Java applications is that the source of Locale information is derived from the Request object. The JAKARTA I18N tag library can automatically read the request object in the default. Locale information, thereby simplifying the complexity of programming and maintenance, of course, the user can also explicitly define Locale information to solve special display problems.