aspose file tools*
The moose likes Beginning Java and the fly likes value not passing to the while loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "value not passing to the while loop" Watch "value not passing to the while loop" New topic
Author

value not passing to the while loop

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Dear Ranchers,
I'm doing a project in JSP. In this I'm passinga value string value status which is equal to 0 and later will convert that to a integer value x. When i put the condition if(x==0) then it is not printing the function.

Please help me to sort out this problem..



Please help me..

Thanks in advance

regards

Aravind Prasad
Pankaj Patel
Ranch Hand

Joined: Jul 13, 2006
Posts: 73
Your code is wrong.

You first tell me is it possible to convert String Variable to Integer.

You had compared your status variable to "all".
Now as for example what if your status value is "all".
It will come to Integer.parse("all") and will generate exception.

You can check it using
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
sorry that code is really wrong.. I sent the wrong one..

the code is here



I hope this is the correct code I'm sending.
Please help me to sort this thing

regards
Aravind Prasad
Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Hi Aravind,

in the beginning of your code there is an if-else statement.



If x isn't initialized (to 0) before the if-else statement and the string
status doesn't equal "all" x wont have the value 0. If it doesn't have the
value 0 the "program" wont enter the if(x==0) block of your code.

Does this make sence?

/Svend Rost
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: value not passing to the while loop
 
Similar Threads
value not passing to the while loop
ResultSet can not print the first row
Error in Remote Server (LinkedList)
Need Help With Dynamic text box in JSP
session problem --======urgent plz======--