Struts Message Resources小記
配置Message Resources的兩種方式:
1.在web.xml中配
2.在struts-confg.xml中
如果要在資源文件中定義一個(gè)動(dòng)態(tài)的內(nèi)容,像“hello:月芽?jī)?#8221;
可以如下:
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>
<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"/>
如果要在資源文件中定義一個(gè)動(dòng)態(tài)的內(nèi)容,像“hello:月芽?jī)?#8221;
可以如下:
message.hello=hello:{0}
在頁(yè)面引用時(shí)傳一個(gè)參數(shù)給它就OK<bean:message key="message.hello" arg0="月芽?jī)?/span>"/>
如果不止一個(gè)參數(shù)就{1}{2}對(duì)應(yīng)arg1 arg2posted on 2007-09-13 15:10 月芽?jī)?/a> 閱讀(636) 評(píng)論(0) 編輯 收藏 所屬分類: J2EE學(xué)習(xí)心得