1.针对不同的国家定义不同的资源文件,资源文件的格式:基名_国家代码_语言代 码.properties,默认的资源文件(当其他的资源文件找不到时,执行默认的资源文件)格式:基名.properties
2.针对中文的资源文件
*文件的名称 resource_zh_CN.properties
*内容:
item.username=用户名
item.password=密码
item.login=登录
3.针对英文的资源文件
*文件的名称resource_en_US.properties
*内容;
item.username=username_en
item.password=password_en
item.login=login_en
4.默认的资源文件
*文件的名称resource.properties
*内容:
item.username=username
item.password=password
item.login=login
5.加载资源文件
*在Struts.xml文件增加如下配置:
value=”cn.itcast.converter.converter, cn.itcast.upload.fileupload, cn.itcast.i18n.resource”>
6.在Jsp页面使用
*引人Struts2的标签库<%@ taglib uri="/struts-tags" prefix="s" %>%@>
*使用
name属性的值应该是资源文件中的key
文章知识点与官方知识档案匹配,可进一步学习相关知识Java技能树首页概览91537 人正在系统学习中 相关资源:国家软件开发标准(doc文档)_软件开发标准-专业指导文档类资源…
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!