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() ; 防止在建消息变量时加上空格而引发不必要的错误。
本文介绍了如何在Struts框架中使用消息资源进行国际化设置,包括配置文件的引用及具体的变量调用方式,并给出了一个避免引入空白字符引起错误的建议。
1441

被折叠的 条评论
为什么被折叠?



