This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes problem in field validation for the Integer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in field validation for the Integer" Watch "problem in field validation for the Integer" New topic
Author

problem in field validation for the Integer

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
i used validations in Struts 2 using <validators> im facing problem with the 'Integer' type value here is the code

if i run the application..
1) if i leave 'Width' textbox empty it is showing 'Width is required' it is working fine
2) if i enter string values i.e., 'abc' is should not take and populate the error as 'Width is number'...but im getting as 'Width is required'
Can any one help me out...in this
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

This topic seems to say that the conversion of the field to a number fails silently if the value is not an number, so it may pass on an null/empty value to the validator, which would cause the behaviour you are seeing.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
wood burning stoves
 
subject: problem in field validation for the Integer
 
Similar Threads
Struts 2 + validate int value.
Struts 2 Validation
Struts2 very simple validation doesn't work
Adding more than one validation to form field
validation problem for cost : struts2