Sorry, but what exactly you mean by "unique" validation? 

> -----Ursprüngliche Nachricht-----
> Von: Nathan Coast [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 5. Mai 2005 13:58
> An: Struts Users Mailing List
> Betreff: Re: unique field validation
> 
> thanks,
> 
> I tried overriding the validate method and it seems to work fine.
> 
>      public ActionErrors validate(ActionMapping mapping,
>                                   HttpServletRequest request)
>      {
>          ActionErrors errors = super.validate(mapping, request);
> 
> // if fail unique validation
>          ActionMessage message = new 
> ActionMessage("errors.unique", messageParams);
>              errors.add("value.emailAddress", message);
> 
>          return errors;
>      }
> 
> 
> Leon Rosenberg wrote:
> > I think this kind of validation has to be done in the 
> business logic, 
> > behind struts.
> > Neither in the action form, nor in the action. 
> > 
> > The business logic should throw appropriate exception, 
> which then can 
> > be handled by struts part of the application.
> > 
> > Regards
> > Leon
> > 
> > 
> >>-----Ursprüngliche Nachricht-----
> >>Von: Nathan Coast [mailto:[EMAIL PROTECTED]
> >>Gesendet: Donnerstag, 5. Mai 2005 10:43
> >>An: struts-user
> >>Betreff: unique field validation
> >>
> >>Hi,
> >>
> >>Is there a standard way to handle validations that can only occur 
> >>server-side?  e.g. unique fields.
> >>
> >>I'm guessing you don't have to include the unique 
> validation in any of 
> >>your validation configuration.
> >>
> >>Is it simply a case of overriding the validate method in my action 
> >>form?
> >>
> >>public ActionErrors validate(ActionMapping mapping, 
> >>       HttpServletRequest request)
> >>{
> >>   ActionErrors errors = super.validate();
> >>
> >>//  do my custom validation
> >>
> >>   return errors;
> >>}
> >>
> >>cheers
> >>Nathan
> >>
> >>------------------------------------------------------------
> ---------
> >>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]
> 
> 



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

Reply via email to