File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes validate for negative number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validate for negative number" Watch "validate for negative number" New topic

validate for negative number

Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 465
hi , how to we validate a number that should not contain negative number in validator ?

thanks in advance !
Ranch Hand

Joined: Oct 09, 2003
Posts: 517

use this in your validation.xml

<field property="propertyname" depends="required,integer,intRange">

hope this would help

God Gave Me Nothing I Wanted<br />He Gave Me Everything I Needed<br /> - Swami Vivekananda
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
you can also use 'validwhen' if you're using struts 1.2.x and do a test for >= 0

-/a<br />certified slacker...yes, my last name is 'do' - <a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: validate for negative number
It's not a secret anymore!