<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
開(kāi)始----運(yùn)行------cmd ------- cd C:"Program Files"Java"jdk1.5.0_06"bin
打命令:native2ascii -encoding GB2312 app.txt app.properties
注釋:GB2312 是生成后的字符集,app.txt是目標(biāo)文件,app.properties是生成后的文件名
將生成的屬性文件app.properties復(fù)制到res
3. 在res下的txt包下制定副本key-zh.txt
name=姓名
submit=提交
以native2ascii -encoding GB2312 app_zh.txt app_zh.properties的方式生成app_zh.properties文件,并復(fù)制到res下,此時(shí)中文被轉(zhuǎn)碼成Unicode碼:
name=\u59d3\u540d
submit=\u63d0\u4ea4
以同樣的方式制定 key-en.txt(等等等)副本
4.將res文件夾編譯到classes
5.配置struts-config.xml文件
6.重啟tomcat,配置成功
測(cè)試:切換瀏覽器默認(rèn)語(yǔ)言(右鍵瀏覽器圖標(biāo)---- 語(yǔ)言 -----)訪問(wèn)項(xiàng)目,查看結(jié)果