struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnaud Cogoluegnes" <acogolueg...@sqli.com>
Subject RE: S2 : Validation per Action method - ideas?
Date Thu, 09 Aug 2007 14:47:57 GMT
You should check the Javadoc of the
com.opensymphony.xwork2.validator.annotations.Validation annotation.

Syntax example:

@Validations(
             requiredFields =
                     {@RequiredFieldValidator(type = ValidatorType.SIMPLE,
fieldName = "customfield", message = "You must enter a value for field.")},
             requiredStrings =
                     {@RequiredStringValidator(type = ValidatorType.SIMPLE,
fieldName = "stringisrequired", message = "You must enter a value for
string.")}
     
     )
     public String execute() throws Exception {
         return SUCCESS;
     }

-----Message d'origine-----
De : j alex [mailto:strutstwouser@gmail.com] 
Envoyé : jeudi 9 août 2007 15:38
À : Struts Users Mailing List
Objet : S2 : Validation per Action method - ideas?

Hi,

Is there a way to declaratively restrict validations depending on the method
within the Action? - this could be useful for wizard-like forms where each
step of the wizard has a set of fields ; corresponds to a different method
but all of them share the same Action.

I can think of having an expression validator based on currentstep added to
every field short-circuited ; but that's more of a workaround rather than
the right way to do it.

Thanks,
Joseph


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


Mime
View raw message