struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alireza Fattahi <afatt...@yahoo.com>
Subject Int Validator
Date Sat, 13 Jul 2013 03:55:44 GMT
Hi,

I want to validate the amount filed to be an integer with minimum value of 1
I describe the field type as Integer (not int )
Add below validation rule
    <field name="amount">
        <field-validator type="required" >
            <message> ${getText("validate.required")}</message>
        </field-validator>
        <field-validator type="int">
            <param name="min">10</param>
            <message> ${getText("validate.int.min")}</message>
        </field-validator>


When the amount is empty I get validate.required error.

When I type a text instead of integer I get  Invalid field value for field "amount" . I don't
know where it comes from and how can I change it.

Also please let me know if I should define the amount as int, Integer or String !


~Regards,
~~Alireza Fattahi
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message