• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in field validation for the Integer

 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9295
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic