Title: RE: display error messages for errors found in an Action


-----Original Message-----
From: Bill Clinton [mailto:[EMAIL PROTECTED]]
Sent: 4. september 2001 22:27
To: [EMAIL PROTECTED]
Subject: Re: display error messages for errors found in an Action


Hi Brian,
     yes, you can do this.  If you have a message in your
ApplicationResources file called my.test.error, you can add an error
like this:

errors.add("myTestField", new ActionError("my.test.error"));

where the string  "myTestField" is the field that caused the error.
 Look at the constructor for org.apache.struts.action.ActionError for
more details.

Bill

Brian K. Buckley wrote:

>Hi,  I'm a relative struts newbie, seeking advise.
>
>I have a class MyForm and in the validate() method of MyForm I check for
>input errors and add them to the ActionErrors object which gets returned.
>
>Later in my MyAction action, I check for additional business logic type
>input errors.  If I find errors, I want to put them into to the same error
>list that the form's ActionErrors creates, so that <html:errors/> in my jsp
>pages can display them the same way.
>
>Is there a way to do this?
>
>-Brian
>
>
>.
>

Reply via email to