Hi!
I'm working with
struts validator.
I have a
jsp with a simple text field which must send only int values.
<html:text property="rec" name="PaginationForm" value=""/>
I want to block any other values different from int.
Below the code in my STRUTS-config.xml (form declaration, calling action, receiving action)
.....
<form-bean name="PaginationForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="rec" type="java.lang.Integer" />
</form-bean>
<action path="/Tab" type="login.InitAction2" input="/Tab2.do" name="PaginationForm" validate="true" scope="session">
<forward name="success" path="/jsp/stima/EsteemSearchResult.jsp" redirect="false" />
</action>
<action path="/Tab2" type="login.InitAction" >
<forward name="success" path="/jsp/stima/EsteemSearchResult.jsp" redirect="false" />
</action>
....
Below,the code in my validation.xml
<formset>
<form name="PaginationForm">
<field property="rec" depends="required,integer">
<arg0 key="PaginationForm.num_records" />
</field>
</form>
</formset>
</form-validation>
OK, the problem is this:
when I insert in the text field a
String, a character or NO value, Struts converts it always in zero.
So the rule "required" is not considered!!!
CAN ANYBODY HELP ME???
THANK YOU