對應表單:
<html:form action="/HelloWorld.do" onsubmit="return check();">
<bean:message key="name"/>
<html:text property="name" size="16" maxlength="16" ></html:text>
<html:submit property="submit" ><bean:message key="submit" /></html:submit>
</html:form>
1.
制定母本,key-E
例:文件名:app.txt
內(nèi)容:name=name
submit=password
2.
將母本轉(zhuǎn)為Unicode碼
將文件app.txt拷貝到jdk的安裝目錄下的bin文件夾內(nèi)
例:路徑:C:"Program Files"Java"jdk1.5.0_06"bin
開始----運行------cmd
------- cd C:"Program Files"Java"jdk1.5.0_06"bin
打命令:native2ascii
-encoding GB2312 app.txt app.properties
注釋:GB2312 是生成后的字符集,app.txt是目標文件,app.properties是生成后的文件名
將生成的屬性文件app.properties復制到res
3.
在res下的txt包下制定副本key-zh.txt
name=姓名
submit=提交
以native2ascii -encoding GB2312 app_zh.txt app_zh.properties的方式生成app_zh.properties文件,并復制到res下,此時中文被轉(zhuǎn)碼成Unicode碼:
name=\u59d3\u540d
submit=\u63d0\u4ea4
以同樣的方式制定 key-en.txt(等等等)副本

4.將res文件夾編譯到classes
5.配置struts-config.xml文件
<message-resources parameter="app" />
注意:parameter要對應母本文件的前綴——app
6.重啟tomcat,配置成功
測試:切換瀏覽器默認語言(右鍵瀏覽器圖標---- 語言 -----)

訪問項目,查看結(jié)果
posted on 2010-01-14 19:48
Ying-er 閱讀(381)
評論(0) 編輯 收藏 所屬分類:
SSH