神秘的 J2ee 殿堂

·古之学者必有师·做学者亦要做师者·FIGHTING·

Struts Message Resources小记

配置Message Resources的两种方式:
1.在web.xml中配
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
    org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>

<param-value>
    com.hunau.liuyong.struts.ApplicationResources
</param-value>

</init-param>
</servlet>

2.在struts-confg.xml中
<message-resources parameter="com.hunau.liuyong.struts.ApplicationResources"/>

如果要在资源文件中定义一个动态的内容,像“hello:月芽儿”
可以如下:
message.hello=hello:{0}
在页面引用时传一个参数给它就OK
<bean:message key="message.hello" arg0="月芽儿"/>
如果不止一个参数就{1}{2}对应arg1 arg2



posted on 2007-09-13 15:10 月芽儿 阅读(618) 评论(0)  编辑  收藏 所属分类: J2EE学习心得


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿(2)

随笔分类

随笔档案

相册

搜索

最新评论

阅读排行榜

评论排行榜