在struts2中,绑定的资源的顺序为:
ActionClass.properties BaseClass.properties (all the way to Object.properties) Interface.properties (every interface and sub-interface) ModelDriven's model (if implements ModelDriven), for the model object repeat from 1 package.properties (of the directory where class is located and every parent directory all the way to the root directory) search up the i18n message key hierarchy itself global resource properties
如:
Package hierarchy
To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties:
com/
acme/
package.properties
actions/
package.properties
FooAction.java
FooAction.properties
If FooAction.properties does not exist, com/acme/action/package.properties will be searched for, if not found com/acme/package.properties, if not found com/package.properties, etc.
但我在项目中,action.media包下有一个MediaAction,再新建一个action.media.MediaAction.properties,这时在Action中getText得不到消息,如果在action下新建一个package.properties,则可以取得.