If your web site needs to be multi-lingual you should place your message
in the Resource bundle. If your message isn't predefined, you could set
up a general error message in your resource bundle that takes an
argument: "error.general={0}". Then you just create an ActionMessage
using a key of "error.general" and pass in your message as an argument.
Scott Mulligan
-Original Message-
From: Bart Busschots [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 04, 2006 11:45 AM
To: Struts Users Mailing List
Subject: Re: ???en_GB. in errors
Hi,
You are supposed to pass in a key for an entry in
application_resources.properties and you are instead passing in the
message you want. Struts is not finding the 'key' you are looking for in
the language you are using en_GB and so it is doing what it always does
when it can't find a message, it is displaying ???the_language
the_key???
You should not be hard-coding in error messages like you are doing,
those messages should be in applicationresources.properties so that you
can internationalize your app. The struts libraries/functions assume you
are using applicationresources.properties because that's the "right way
(tm)" to do things.
Hope that makes sense,
Bart.
Shoukat, Faisal wrote:
> Hi,
>
> I throw a application exception back to the web layer and catch it in
> my action class. I then create a errors object with the exception as
follows:
>
> errors.add("errors", new ActionMessage(e.getCause().getMessage()));
> saveErrors(request, errors);
>
> When it displays the error on the jsp it displays the following
>
> ???en_GB.This form is invalid.???
>
> How do I get rid of the ???en_GB. And ??? in the error. All I want to
> display is the This form is invalid.
>
> Because it is an application exception and could be a number of things
> I have not added anything to the message resources bundle
>
> Thanks
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]