wood burning stoves 2.0*
The moose likes Struts and the fly likes Validate method not completing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validate method not completing" Watch "Validate method not completing" New topic
Author

Validate method not completing

MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
I have following code, in which second if is not working in validate method.



In above code, even if I fail to enter name, second 'if' is not failing, its invoking execute method. Although 'if' clause for 'number' is working fine, means if I enter number less than 0, its addFieldError method is getting called.
What could be the problem with above code snippet?

I am slow but sure
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

You've checked if String's length is less than 0, you'll have to check if its == 0...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi ..

Here you are getting a length 0.

It must be ==0
0r <=0


Thanks.


Good luck!!
A small leak can sink a Gigantic ship.>
MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
Its working fine now Raza
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validate method not completing