为什么我们使用struts.custom.i18n.resources?

时间:2014-05-27 05:27:28

标签: java-ee struts2

为什么我们在Struts2 Framework中struts.custom.i18n.resources?它的好处是什么?如果我们不定义它会发生什么?

1 个答案:

答案 0 :(得分:0)

这用于声明应用程序的全局资源包。

Struts 2按以下顺序搜索资源:

  1. ActionClass.properties
  2. Interface.properties(每个接口和子接口)
  3. BaseClass.properties(一直到Object.properties)
  4. ModelDriven的模型(如果实现ModelDriven),用于模型 对象重复从1
  5. package.properties(类所在的目录和 每个父目录一直到根目录)
  6. 搜索i18n消息密钥层次结构本身
  7. 全球资源属性
  8. 你要问的常数是声明在7中搜索的包。

    参考:http://struts.apache.org/release/2.3.x/docs/localization.html

    好处 - >声明跨职能全局可用属性。

    如果您没有定义它,该怎么办?>没有什么不好的事情会发生。