一、国际化
<constant name="struts.custom.i18n.resources" value="itcast" />
package com.dzq.action; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class ManagerAction extends ActionSupport{ @Override public String execute() throws Exception { ActionContext.getContext().put("message", this.getText("welcome")); return "message"; } }
<s:text name="welcome"> <s:param><s:property value="realname"/></s:param> <s:param>学习</s:param> </s:text>
package com.dzq.action; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class ManagerAction extends ActionSupport{ @Override public String execute() throws Exception { ActionContext.getContext().put("message", this.getText("welcome",new String[]{"liming","study"})); return "message"; } }
<s:i18n name="itcast"> <s:text name=“welcome”/> </s:i18n>
<s:i18n name=“cn/itcast/action/package"> <s:text name="welcome"> <s:param>小张</s:param> </s:text> </s:i18n>
原文:http://www.cnblogs.com/xiaoduc-org/p/5452535.html