國際化問題,高分請教

huangjiuyt 2003-04-16 03:55:27
我现在有三个文件
ApplicationMessageResources_zh_CN.properties
2。ApplicationMessageResources_zh_TW.properties
3。ApplicationMessageResources.properties
都通过native2ascii编译好了,请问一下我还对web.xml和struts-config.xml设置什么吗,
我看见struts-config.xml里有
<message-resources
parameter="org.apache.struts.webapp.example.ApplicationResources"/>

<message-resources
parameter="org.apache.struts.webapp.example.AlternateApplicationResources"
key="alternate">
</message-resources>
这样配置有什么用,就这样就行了吗
对了,还有,那些propertes文件的命名必须是固定的吗,不能根据自己的方式来命名吗,
...全文
32 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
runi 2003-09-11
  • 打赏
  • 举报
回复
学习!
Geranium 2003-09-11
  • 打赏
  • 举报
回复
http://www.oreilly.com.tw/sleepless/java_big5_1.htm
maobing 2003-09-11
  • 打赏
  • 举报
回复
up
zh_baiyu 2003-04-17
  • 打赏
  • 举报
回复
应该 两种方法都可以配置的。
看你自己习惯哪一种了~
huangjiuyt 2003-04-17
  • 打赏
  • 举报
回复
up
huangjiuyt 2003-04-16
  • 打赏
  • 举报
回复
但我的web.xml沒有<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
但在strut-config.xml中油
<message-resources
parameter="org.apache.struts.webapp.example.ApplicationResources"/>

<message-resources
parameter="org.apache.struts.webapp.example.AlternateApplicationResources"
key="alternate">
</message-resources>
他也能運行,怎麼回事
怎麼配置才好呢
zh_baiyu 2003-04-16
  • 打赏
  • 举报
回复
在web.xml文件里添加:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
主要是这段
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
ApplicationResources是文件名(ApplicationResources.properties)中的名称
而且这个文件放到web-inf\classes\目录下。

同时,必须保证你的struts安装完全。你必须把common*.jar文件全部拷贝到
web-inf\lib目录下!

哈哈,做完上面几步就可以运行了!!!
我也是这两天刚好在研究这个问题。
huangjiuyt 2003-04-16
  • 打赏
  • 举报
回复
還搞不定,在up
Ali 2003-04-16
  • 打赏
  • 举报
回复
Hi,
Plz. modify the web.xml file with information like

<web-app>
<servlet>
.......
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>filename</param-value>
</init-param>
....

Plz. note that filename can be any but dont' enter the absolute path. If you are using the JBuilder IDE then put the filename with .properties extension in the src folder or in package name folder if you have any.

for example i have package name like myPackage and file name is resources then
put the resources.properties file in the following location

../src/myPackage/resources_Localte_Country.properties.

Hope it helps.

Regards,
Ali
fanciex 2003-04-16
  • 打赏
  • 举报
回复
mark!!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧