struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@gmail.com>
Subject Re: Need help in how to display error messages
Date Sat, 05 Aug 2006 00:41:08 GMT
The reason this is happening is because (normally) your ActionMessage
contains the key - and then the <html:messages> tag looks up the
actual message (i.e. "resolves the message") - but you're actually
resolving the message yourself in the Action.

Try just creating the ActionMessage with the key:

ActionMessage error =
    new ActionMessage("error.message.filemanagement.errorsavingconfiguration");

Niall

On 8/5/06, Niniva Ray <ninivaray@yahoo.com> wrote:
>    Hi,
>
>   I am working on a web application where I am using struts 1.2.9.
>   The problem I am encountering is whenever I want to show any messages on the browser,
suppose if I want to show the message "Error saving configuration",
>   it is displaying ???en_US.Error saving configuration???
>
>   The details of what I have are
>   In my struts-config file I have
>   <message-resources parameter="com.mng.filemanagement.resources.FileManagementResources"
null="false"/>
>
>   I have FileManagementResources.properties file in the com.mng.filemanagement.resources
package.
>
>   In this properties file I have the entry,
>   error.message.filemanagement.errorsavingconfiguration=Error saving configuration
>
>   In my Action class I have,
>   MessageResources messageResources = getResources(request); // request is HttpServletRequest
>   ActionMessage error = new ActionMessage(messageResources.getMessage("error.message.filemanagement.errorsavingconfiguration"));
>   ActionMessages errors = new ActionMessages();
>   errors.add(FileManagementConstants.ERROR_KEY, error); // FileManagementConstants.ERROR_KEY
is a string with value error
>   addErrors(request, errors);
>
>   In my jsp page I have
>   <logic:messagesPresent property="error">
>   <html:messages id="message" property="error">
>   <bean:write name="message"/><br>
>   </html:messages>
>   </logic:messagesPresent>
>
>   This displays ???en_US.Error saving configuration???
>   when error happens, instead of Error saving configuration.
>
>   I am supporting only one language English.
>   I think I am missing something, could anyone give me some pointers what I am doing
wrong?
>
>   Thanks,
>   NR
>
>
> ---------------------------------
> See the all-new, redesigned Yahoo.com.  Check it out.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message