You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Coast <na...@codeczar.com> on 2005/05/05 10:42:48 UTC

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: unique field validation

Posted by Leon Rosenberg <st...@anotheria.net>.
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:nathan@codeczar.com] 
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org