1
我的Web程序配置是Struts2和Tomcat 6.0。Struts2 ActionSupport getTexts()不工作
和我的項目是支持i18n的(國際〜)
我用類擴展com.opensymphony.xwork2.ActionSupport
。
getText(String)
方法有效,但getTexts()
不起作用。
public class MyAction extends ActionSupport {
public void textString() {
// print "en" works
String strTemp1 = getText("CURRENT.LOCALE");
System.out.println(strTemp1);
// This doesn't; bundle is null.
ResourceBundle bundle = getTexts();
System.out.println(bundle);
}
}
globalMessage_en.properties
CURRNET.LOCALE = en
你可以提供詳細信息,如何訪問that.generally getTexts()獲取與實現類相關的資源包(通常是一個操作)。 –
屬性文件中的'CURRENT.LOCALE'拼寫錯誤是否爲拼寫錯誤?另外,你如何在S2配置中聲明全局消息資源? –
Thx確實有幫助 – afraxas