action 如何读取ApplicationResources.properties

来源:互联网 发布:复杂网络算法研究 编辑:程序博客网 时间:2024/04/30 23:18

MessageResources resources = MessageResources.getMessageResources("com.config.ApplicationResources");
String   freight = resources.getMessage("freight");

com.config.ApplicationResources是在struts.config.xml里面最下面定义的message resource 中parameter中引号的内容。

freight 是在ApplicationResources.properties中定义的费用变量消息。

freight=15

建议:在resources.getMessage("freight").trim(); 防止在建消息变量时加上空格而引发不必要的错误。

原创粉丝点击