Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Integer object validation not working

Bruno

2010-04-09


Author LoginPost Reply
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: brunomv@(protected)
Msn: brunom_@(protected)
Icq: 165055101
Skype: morellibmv
©2008 gg3721.com - Jax Systems, LLC, U.S.A.