记得在看JRun文档时,在说到本地化和国际化时,其解决方案之一是: (小弟我e文不好,为了不影响大家理解,贴上原文了) Using ResourceBundles ----------------------------- ResourceBundles let you create a separate source file for each locale that you support in your web applications. These files can contain text or other objects, such as images, that are specific to each locale. ResourceBundles are an abstract class in the java.util package and must be implemented as one of the following subclasses: • ListResourceBundle Use to store pointers to images or other objects in your resource bundle. Uses Java classes to store resource information. • PropertyResourceBundle Use to store text in your resource bundle. Uses plain-text property files to store the raw data. If your web application requires mostly localized text information, then it is easiest to use property files (required by PropertyResourceBundle) rather than class files (required by ListResourceBundles) to store your data. JRun uses the following conventions to determine which resource bundle to fetch based on the filename: ClassName_languagecode_COUNTRYCODE.class ClassName_languagecode_COUNTRYCODE.properties The languagecode is mandatory except for the default system locale, such as en. The COUNTRYCODE is optional. When you invoke the getBundle method with the locale, JRun fetches the proper resource class or file automatically. For example, if the locale is set to Japanese, JRun fetches MyResources_ja.class or MyResources_ja.properties. To use resource bundles in your web applications, you provide the client locale to the ResourceBundle.getBundle method. Then you invoke the appropriate methods on the resource bundle, as the following example shows: ... ResourceBundle bundle = ResourceBundle.getBundle(“Resources”,request.getLocale());
<head><title><%= bundle.getString("title") %></title></head>
<%-- Display all the contents based on ResourceBundle --%>
<h2><%= bundle.getString("hello_message") %></h2>
... The contents of the resource bundle properties file are as follows: title=Morning Greeting hello_message=Good Morning For an example, see SampleJDBCLoginModule in the /samples/SERVER-INF/lib/jrun/samples/security directory.