• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need a validator to check the number is positive

 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

This is a very basic question I guess, but I am a newbie with Struts
Before submitting my form, I would like to validate it.

In validator-rules.xml, there is the validator "required" to check that a field has been filled.
Does anyone know of a validator that checks if the number entered is positive ?


Thanks
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
since you're a newbie, i hope you are going with a later struts version, that is 1.2+ . with 1.2.x your can use the validwhen rule. simply test for *this* > 0 (see the struts user guide on validation for this). you can use also 'range' validation, but i believe you need to specify the max with this rule.
 
reply
    Bookmark Topic Watch Topic
  • New Topic