This will help you :)
don't forget to add validate=true in your struts-config.xml
public class MyForm extends ActionForm {
public static int MAX =100;
private Integer value;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest args) {
ActionErrors errors = new ActionErrors();
if (getValue().intValue()<0)
errors.add("value",new ActionMessage("value.MustBePositive"));
if (getValue().intValue()>=MAX)
errors.add("value",new ActionMessage("value.MustBeBelowMax"));
return errors;
}
}
Francisco Antonio Vieira Souza a écrit :
> Considering that nobody saw my big previous message about this subject.
> I ask you all, does anyone could provide me any example of validation
> in Struts 1.2.7? (since until now I had no success)
>
>
>
>
>
> _______________________________________________________ Novo Yahoo!
> Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito
> mais. Instale agora! www.yahoo.com.br/messenger/
>
> ---------------------------------------------------------------------
> 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]