It is very convenient for struts to read attribute files. What's more handsome is that attribute files contain parameters.
1. Preparation: first convert Chinese to unicode encoding
1. http://www.chinaue.com/tool/uni.htm online conversion unicode encoding, huh (can also be directly searched for Unicode conversion)
2. If you cannot access the Internet, use the native2ascii file that comes with JDK.
1. Create a text document on the desktop with name = Zhang San, and save it to the C root directory,
File Name: A. properties, save type: All types
2. Enter cmd in the run of the Start menu, then cd c :\,
Copy native2ascii-encoding gb2312 A. properties a_zh.properties (note that do not press Ctrl + V)
3. Press enter and copy a_zh.properties to SRC of the project on drive C.
1. Add two Property Files under SRC: a_en.properties name = zhangsan
A_zh.properties name = & #24352; & #19977; (directly copied)
2. Configure in sturs-config.xml
<Message-resources parameter = "A" Key = "A1"/>
<Message-resources parameter = "applicationresources" Key = "app"/>
3. Call the page, modify the default language of IE, and output the user name.
<Bean: Message key = "name" bundle = "A1"/> // find the corresponding property file in sturs-config.xml through bundle = "A1"
Then find the corresponding value through name
4. Run the command to view the effect of Chinese characters (output: James)
View English results (output: zhangsan ):
In the browser, change the language: in the browser menu bar-> Tools-> Internet Options-> Add-> English [En]-> move up to the first
5. include parameters in the property File
Name = {0} & #24352; & #19977; // {0} is a placeholder
<Bean: Message key = "name" bundle = "A" arg0 = "hello"/> // assign a value to the placeholder
6.Code: Code download