You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vivek Sundararaman <vi...@vivraji.com> on 2002/08/25 08:06:56 UTC
How to Build error messages dynamically??
Hello all
I would appreciate any/ all help for my problem.
We are storing all the errors & messages displayed to the users in a
database.
We are having a controller making the calls to the database and
returning the presentation layer asset of errors or messages to be
displayed.
In my actionclass, after I make the call to the controller, based on the
success or failure of the call, I build the actionerrors with the
message sent back from controller call. These messages are not
maintained in the appresources.properties
The code in my actionclass looks like:
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.tablemessage", "Pass
My message"));
saveErrors(request, errors);
In my appresources.properties
error.tablemessage={0}
In my jsp
<html:errors/>
This does not print the error message"Pass My message" on the page.
How to make a dynamic error or message appear in the page?
(I tried to look in the archives for answers, but couldn't find one. May
be I missed it too.)
Thank you
Vivek
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to Build error messages dynamically??
Posted by vivraji <vi...@vivraji.com>.
Oops. I found where the problem is:
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.tablemessage", (String)"Pass My message"));
saveErrors(request, errors);
Pass the message as a String Object or Integer Object is what is
expected :)
Thank you Phil.
- Vivek
--- In struts@y..., Phil Steitz <ph...@s...> wrote:
> Vivek Sundararaman wrote:
>
> >Hello all
> >
> >I would appreciate any/ all help for my problem.
> >
> >We are storing all the errors & messages displayed to the users in
a
> >database.
> >We are having a controller making the calls to the database and
> >returning the presentation layer asset of errors or messages to be
> >displayed.
> >
> >In my actionclass, after I make the call to the controller, based
on the
> >success or failure of the call, I build the actionerrors with the
> >message sent back from controller call. These messages are not
> >maintained in the appresources.properties
> >The code in my actionclass looks like:
> >
> >ActionErrors errors = new ActionErrors();
> >errors.add(ActionErrors.GLOBAL_ERROR,
> > new ActionError
("error.tablemessage", "Pass
> >My message"));
> >saveErrors(request, errors);
> >
> >In my appresources.properties
> >error.tablemessage={0}
> >
> >In my jsp
> ><html:errors/>
> >
> >This does not print the error message"Pass My message" on the page.
> >
> >How to make a dynamic error or message appear in the page?
> >
> >(I tried to look in the archives for answers, but couldn't find
one. May
> >be I missed it too.)
> >
> >Thank you
> >Vivek
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail: <ma...@j...>
> >For additional commands, e-mail: <ma...@j...>
> >
> Vivek,
>
> I have used syntax nearly identical to yours successfully in Struts
> 1.02. Could be a problem with your jsp or control flow. Do you
see
> the errors header and footer displayed or are you getting a blank
page?
>
> I would suggest the following:
>
> 0. Inspect your container logs
> 1. Verify that you have the struts bean and html tag libs
referenced in
> your jsp and there are no other problems in the jsp
> 2. Add some logging to verify that the ActionErrors constructor is
> getting the actual parameters that you think it is getting
> 3. Add logging to verify that the saveErrors is getting executed
>
>
> hth,
>
> Phil
>
>
> --
> To unsubscribe, e-mail: <ma...@j...>
> For additional commands, e-mail: <ma...@j...>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to Build error messages dynamically??
Posted by Phil Steitz <ph...@steitz.com>.
Vivek Sundararaman wrote:
>Hello all
>
>I would appreciate any/ all help for my problem.
>
>We are storing all the errors & messages displayed to the users in a
>database.
>We are having a controller making the calls to the database and
>returning the presentation layer asset of errors or messages to be
>displayed.
>
>In my actionclass, after I make the call to the controller, based on the
>success or failure of the call, I build the actionerrors with the
>message sent back from controller call. These messages are not
>maintained in the appresources.properties
>The code in my actionclass looks like:
>
>ActionErrors errors = new ActionErrors();
>errors.add(ActionErrors.GLOBAL_ERROR,
> new ActionError("error.tablemessage", "Pass
>My message"));
>saveErrors(request, errors);
>
>In my appresources.properties
>error.tablemessage={0}
>
>In my jsp
><html:errors/>
>
>This does not print the error message"Pass My message" on the page.
>
>How to make a dynamic error or message appear in the page?
>
>(I tried to look in the archives for answers, but couldn't find one. May
>be I missed it too.)
>
>Thank you
>Vivek
>
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
Vivek,
I have used syntax nearly identical to yours successfully in Struts
1.02. Could be a problem with your jsp or control flow. Do you see
the errors header and footer displayed or are you getting a blank page?
I would suggest the following:
0. Inspect your container logs
1. Verify that you have the struts bean and html tag libs referenced in
your jsp and there are no other problems in the jsp
2. Add some logging to verify that the ActionErrors constructor is
getting the actual parameters that you think it is getting
3. Add logging to verify that the saveErrors is getting executed
hth,
Phil
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>