hi kalyan,
for the same thing i have worked on this couple of weeks back. you need to implement u r own validation rule for this negative integer not to accept . for that u need to write code in validation-rues.xml file,validation.xml and java class for supporting condition. here is the code for u r reference.
</validator>
<validator name="myNegativeIf"
classname="com.oomc.servicing.icar.web.validator.M yFieldChecks"
method="myNegativeIf"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.myNegativeIf">
<javascript>
</javascript>
</validator>
<field property="contract.contractDefault.thresholdAmount "
depends="myNegativeIf,integer">
<arg0 key="label.contract.threshholdAmount"/>
</field>
// Negative number validation added by vimal 12/18/2007
public static boolean myNegativeIf(
Object bean,
ValidatorAction va,
Field field,
ActionErrors errors,
HttpServletRequest request ) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
int value1=0;
try{
value1= Integer.parseInt(value);
}
catch (Exception e) {
}
// System.out.println("Value if int not negative is "+value1);
// System.out.println("value = " + value + "XXXXX");
//String sProperty2 = field.getVarValue("secondProperty");
//String value2 = ValidatorUtil.getValueAsString(bean, sProperty2);
// System.out.println("value2 = " + value2 + "YYYYY");
if (!GenericValidator.isBlankOrNull(value)) {
try{
if (value1 < 0) {
errors.add(field.getKey(),Resources.getActionError (request, va, field));
return false;
}
} catch (Exception e) {
errors.add(field.getKey(),Resources.getActionError (request, va, field));
return false;
}
}
return true;
}
Thanks& Regards,
VimalSagar
vimal.y@gmail.com