Home > FAQs > How do I set a global resource bundle

In Struts 2, resource bundles can be associated with classes. The framework will automatically discover and load class-orientated resource bundles. You can also specify one or more global resource bundles, which would be available to all classes in the application, using either the standard properties file, or a custom listener.

Properties file

Global resource bundles can be specified in the struts.properties configuration file.

struts.properties
Icon

The framework searches the class heirarchy first, then, as a last resource, checks the global resources.

Multiple resource bundles can be specified by providing a comma-separated list.

struts.properties

Listener

Aside from the properties file, a Listener could also be used to load global resource bundles.

ActionGlobalMessagesListener.java

web.xml:
(under listeners section)

web.xml