在今天的java商城开发中,外贸商城成为了沿海地区的一个主要开发的主流。而在三大框架中的Struts2中,我记得就为我们开发人员提供过一个语言国际化的i18n这个配置东西。下面我就将配置问价给大家看一看
language_en.properties英文表单的配置
userName=please into your name\:
title=Register
userAge=please into your age\:
birthdate=please into your birthdate
point=please into your point
submit=submit
language_zh_CN.properties英文表单的配置
userName=\u8BF7\u8F93\u5165\u7528\u6237\u540D\uFF1A
userAge=\u8BF7\u8F93\u5165\u5E74\u9F84\uFF1A
birthdate=\u8BF7\u8F93\u5165\u51FA\u751F\u65E5\u671F\uFF1A
point=\u8BF7\u8F93\u5165\u60A8\u7684\u5750\u6807\uFF1A
submit=\u63D0\u4EA4
title=\u6CE8\u518C
下面是Struts2的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "struts-2.1.dtd" >
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.ui.theme" value="xhtml"></constant>
<constant name="struts.custom.i18n.resources" value="language"></constant>
<constant name="struts.i18n.encoding" value="utf-8"></constant>
<package name="bochystruts2" extends="struts-default">
<action name="formaction" class="cn.com.bochy.action.Fromaction">
<result name="success">/main.jsp</result>
<result name="input">/index.jsp</result>
</action>
</package>
</struts>
剩下的代码就和原来的一样了 ,扫描二维码您可以了解更多
