Thoughts on the International Treatment of Struts - -
First, Struts Internationalization Struts is a web framework supporting international MVC. But how to use Struts internationalization is a problem. Let's discuss how to implement the internationalization of Struts. The internationalization of the Web program involves 3 levels. First, the input / output of the JSP section; the second, the application handler is international; third, DB internationalization. It is mainly discussed here that the input / output problem of the JSP portion is discussed. Second, the internationalization of the static part of the Struts JSP page static content (including static text, still pictures) internationalization, is achieved by resource files. To achieve internationalization, you need to do the following work: 1. Define the parameters of the moving ActionServlet of Web.xml; 2. Define resource files; 3. Define the character set of the JSP page; 4. Get the content in the resource file in the JSP page . 1. Define the parameters of the actionServlet for Web.xml
Label.username = username: label.password = password: //applicationresources_zh_cn.bak; Simplified Chinese resource file. The content inside is Chinese. It requires the tool to process the content into UTF-8Label.userName = username: label.password = password: //applicationResources_zh_tw.bak: Traditional Chinese resource file. The content inside is Chinese. It requires the tool to process the content into UTF-8, the following content is a traditional code. label.username = Techno Circular W:? label.password = Techno Circular W:? 2.2 preparation is completed, create a resource file UTF-8 bundle native2ascii -encoding gb2312 ApplicationResources_zh_CN.bak ApplicationResources_zh_CN.propertiesnative2ascii -encoding big5 Applica tionResources_zh_TW use the following command. Bak ApplicationResources_zh_tw.properties 3, Defining the Language of the JSP page to define the language of the JSP page to UTF-8. At each JSP page, you must have the following content (if you use template technology, you just need to add it on the template page, other pages that use this template do not need to be added) <% @ Page ContentType = Text / HTML; charset = UTF- 8 "%> 4, get the contents of the resource file in the JSP page. In the JSP, you need to display static contents in the Message label in the bean tag package of