The answer is, (someone correct me if i am wrong!)

No, Globals.MESSAGES_KEY key only holds the default MessageResources. If you look you 
will find an attribute named 'systemErrors' wich contains the MessageResources object 
of app.resources.SystemErrors

And if you use this bundle for error messages, notice the use of bundle in 
<html:errors>

<html:errors bundle="systemErrors"/>

Henrique Viecili

----- Original Message ----- 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] 
  Sent: Monday, July 05, 2004 12:23 PM
  Subject: Message Resources Confusion


  Greetings,

  I am somewhat unclear with the Message Resources.

  I have defined in my struts-config:
  <message-resources parameter="app.resources.ApplicationResources"/>
  <message-resources parameter="app.resources.SystemErrors" 
  key="systemErrors"/>

  In my Action class I have the following code:
  if (getSPName() == null) {
          MessageResources errorMessages = (MessageResources) 
  request.getAttribute(Globals.MESSAGES_KEY);
          String errorMessage = 
  errorMessages.getMessage("errors.invalid.SPName");

          logger.error(errorMessage);

          errors.add(ActionErrors.GLOBAL_MESSAGE, new 
  ActionMessage("errors.9000"));
          saveErrors(request, errors);
          return 
  mapping.findForward(errorMessages.getMessage("forward.systemError"));
  }

  Question 1:
  Does the request.getAttribute(Globals.MESSAGES_KEY) load the keys of both 
  resources found in the struts-config?
  The message with the key ("errors.invalid.SPName") returns a null.

  Question 2:
  If I code it this way the message found.
  MessageResources errorMessages = this.getResources(request, 
  "systemErrors");


  Any help explaining this is appreciated.

  TIA,
  Glenn

Reply via email to