jp.terasoluna.fw.web.struts.action
Class PropertyMessageResourcesEx

java.lang.Object
  extended by org.apache.struts.util.MessageResources
      extended by org.apache.struts.util.PropertyMessageResources
          extended by jp.terasoluna.fw.web.struts.action.PropertyMessageResourcesEx
All Implemented Interfaces:
java.io.Serializable

public class PropertyMessageResourcesEx
extends org.apache.struts.util.PropertyMessageResources

Property file message resources which enables the display of system (framework) message resources and the message resources which are common to all modules.

As per the Struts specifications, message resource definition is independent for each module. Hence, the message resources common to all modules cannot be uniquely defined.
TERASOLUNA provides the method of using the application messages and system messages common to all modules
This class extends PropertyMessageResources of Struts and enables to use not only the message resource definition file of each module but also application messages and system messages.
For the contents defined in the application message resources and system message resources, refer to GlobalMessageResources.

How to use
To use this class, specify the following in the <message-resource> element of struts-config.xml Following is the configuration example of struts-config.xml.

 <struts-config>
   ...
   <message-resources parameter="MessageResources"
                      factory="jp.terasoluna.fw.web.struts.action.PropertyMessageResourcesExFactory"
   />
  ...
 </struts-config>
 
Constraints
  1. System message reources does not support internationalization.
  2. Application message resources does not support internationalization.
The priority sequence for fetching the message resources with the same key, is as follows.
  1. Message resources of message resource definition file
  2. Message resources of the application resource definition file(application-messages.properties)
  3. Message resources of system message resource definition file(system-messages.properties)

See Also:
PropertyMessageResourcesExFactory, DBMessageResources, GlobalMessageResources, Serialized Form

Field Summary
private static long serialVersionUID
          Serial version ID
 
Fields inherited from class org.apache.struts.util.PropertyMessageResources
locales, log, messages
 
Fields inherited from class org.apache.struts.util.MessageResources
config, defaultFactory, defaultLocale, factory, formats, returnNull
 
Constructor Summary
PropertyMessageResourcesEx(org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config)
          Constructor.
PropertyMessageResourcesEx(org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config, boolean returnNull)
          Constructor.
 
Method Summary
 java.lang.String getMessage(java.util.Locale locale, java.lang.String key)
          Fetches the messages. The priority sequence for fetching the messages, is as follows: 1)Message resources defined in each module, 2)Messages in the Application message resource file and 3)Messages in System message resource file
 
Methods inherited from class org.apache.struts.util.PropertyMessageResources
loadLocale
 
Methods inherited from class org.apache.struts.util.MessageResources
escape, getConfig, getFactory, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessageResources, getReturnNull, isEscape, isPresent, isPresent, localeKey, log, log, messageKey, messageKey, setEscape, setReturnNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version ID

See Also:
Constant Field Values
Constructor Detail

PropertyMessageResourcesEx

public PropertyMessageResourcesEx(org.apache.struts.util.MessageResourcesFactory factory,
                                  java.lang.String config)
Constructor.

Parameters:
factory - Factory object of this class
config - Message resource file name

PropertyMessageResourcesEx

public PropertyMessageResourcesEx(org.apache.struts.util.MessageResourcesFactory factory,
                                  java.lang.String config,
                                  boolean returnNull)
Constructor.

Parameters:
factory - Factory object of this class
config - Message resource file name
returnNull - Check if it returns null when message resource key is not registered.
Method Detail

getMessage

public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String key)
Fetches message. the priority sequence for fetching the messages, is as follows.
  1. Message resources defined in each module, Messages in the file
  2. Application messages
  3. System messages

Overrides:
getMessage in class org.apache.struts.util.PropertyMessageResources
Parameters:
locale - Locale fetched from the request
key - Message resource key
Returns:
Message