>From this and other messages I think you've got the wrong end of the stick
regarding the <html:errors> tag. You can use either <html:errors> or
<html:messages> with ActionMessage, its just down to personal preference.
I've added a page comparing <html:errors> and <html:messages> here:

http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html

You can use either

As for the validate method in your action form - then whether you use
<html:errors> or <html:messages> the you can do something like the
following...

public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

   ActionErrors errors = new ActionErrors();

   if (<some conditon here>) {
        errors.add("myProperty", new ActionMessage("myProperty.error"));
   }

   return errors;

}

Niall

----- Original Message ----- 
From: "Fergal O'Shea" <[EMAIL PROTECTED]>
To: "'Riyaz Mansoor'" <[EMAIL PROTECTED]>; "'Struts Users Mailing List'"
<user@struts.apache.org>
Sent: Tuesday, April 05, 2005 5:21 PM
Subject: RE: Html:messages vs html:errors


>
> We don't seem to have struts-examples.war readily available here at work.
>
> Does anyone have an example of overriding an ActionForm's validate()
method,
> but using ActionMessage instead of ActionError (I presume you still have
to
> use a Collection of ActionErrors), and using html:messages instead of
simple
> old <html:errors/>.
> Specifically, how does one tie in the id parameter in html:messages with
the
> ActionErrors Collection returned by one's validate() method ?



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to