File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes variable to initialize not working? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "variable to initialize not working?" Watch "variable to initialize not working?" New topic

variable to initialize not working?

Nelson Nadal
Ranch Hand

Joined: Jun 06, 2002
Posts: 170
I'm just newbie in JSF and I was stuck in this code for the whole day.

I've got a simple JSP program where you can put on a textfield and guess the generated random number, it has a link where you can reload (to generate new random number and initialize the i variable as number of attemps made) . When I use the navigational case xml in faces-config.xml and use the class in CODE A, the program is working fine.

But when I modified the the class and make another class as listener the i variable and generatedNumber is not initializing anymore. I almost ran out of solution. Please help.

the jsp program simply runs like this.

in start of prgram, the class will generated a random number (0-9).
Then I will put my number to guess.
If not correct i variable will increment by one (this is the number of attempts made)

In case I click the 'Reload' link, there should be another random number and i variable shld go to 0 again.

The problem:
When I click 'Reload' link its not doing another random number, and i variable never return to 0
the old random number shows and i variable continues to increment.

Other story:
The CODE A, this is working fine. When I click' Reload' in my JSP, its generated new number and variable i initializes again.

Then I changed it as listener, then the problem (I stated above) occurs.

I hope my story is clear, I really stuck in this problem, thanks and appreciate your help. If you need more clearer explanation please just tell me to elaborate more.



I agree. Here's the link:
subject: variable to initialize not working?
It's not a secret anymore!