I'm trying to make a "required" validation on a field with a Integer object
value, but it doesn't work. Conversion validation is working fine, but
required validation is not working when I set the field with a blank value.

Using Struts 2.1.6.

Here are some ways which I've tried to make it work

Attempt 1
<field name="dbServer.port">
<field-validator type="int">
<message>You must inform a port</message>
</field-validator>
</field>

Attempt 2
<field name="dbServer.port">
<field-validator type="requiredstring">
<message>You must enter a a port</message>
</field-validator>
</field>

Attempt 3
<field name="dbServer.port">
<field-validator type="fieldexpression">
<param name="expression">
dbServer.port != null && !dbServer.port.toString().equals("")
</param>
<message>
You must enter a port
</message>
</field-validator>
</field>



-- 
Bruno Morelli Vargas
Mail: brun...@gmail.com
Msn: brun...@hotmail.com
Icq: 165055101
Skype: morellibmv

Reply via email to