资源文件传参数(转码)

来源:互联网 发布:达梦数据库dm6下载 编辑:程序博客网 时间:2024/06/11 01:29

log.jsp 

用到资源文件,传参数:用中文
  <html:form action="/login">
   <bean:message key="info.input" arg0="帐号" bundle="CH"/><html:text property="account"/><html:errors property="account"/><br/>
   <bean:message key="info.input" arg0="密码" bundle="CH"/><html:password property="password"/><html:errors property="password"/><br/>
   <html:submit/><html:cancel/>
  </html:form>

temp.properties 资源配置文件

# 资源文件.格式:key=value     #是注释

#native2ascii -encoding gb2312 源文件名,目标文件名
#用资源文件传参数,参数从{0}.....{4}
info.input=<font color=red>请你输入 {0}:</font>

struts-config.xml配置文件

<!-- 定义其它资源文件 特意指定资源文件key -->
  <message-resources key="CH"  parameter="prj7_1.ApplicationCHResources"/>

 

1.配置path:

添加native2ascii当前的路径,注意在java >jdk1.5>bin下面

2.cmd

3.切换目录 cd   /c   d:

4.cd /d   native2ascii的目录

5.在native2ascii的目录下

 

native2ascii  –encoding  gb2312  源文件名(temp.propertiy),目标文件名