struts.custom.i18n.resources = global
struts.custom.i18n.resources = global, another-properties-file
<struts> <constant name="struts.custom.i18n.resources" value="global" /> </struts>
package com.tw511.common.listener; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import com.opensymphony.xwork2.util.LocalizedTextUtil; public class GlobalMessagesListener implements ServletContextListener { private static final String DEFAULT_RESOURCE = "global"; public void contextInitialized(ServletContextEvent arg0) { LocalizedTextUtil.addDefaultResourceBundle(DEFAULT_RESOURCE); } public void contextDestroyed(ServletContextEvent arg0) { } }
web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Struts 2 Web Application</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class> com.tw511.common.listener.GlobalMessagesListener </listener-class> </listener> </web-app>