I'm using Eclipse Helios, Apache Tomcat 6.0.29 and JSF 1.2. I'm having a simple application which has a Login page, Home Page and a Logout page. Once the user logs in, a session variable is set and Home page is displayed which has a logout button. When I launch Eclipse and run the Login page and use the correct credentials, I'm able to go to the home page but when I re-run the Login page, I get an error saying "view cannot be restored".
How do I resolve this exception? PFB the exception.
Also, when I re-run the application and when the Login page comes up, I press the refresh button in the Eclipse browser and after that I dont get any such exception. If I dont refresh the login page after a re-run of the application, I get the above exception. How do I get rid of this exception?
Not sure why you're using a session variable. If you're in JSF then your login page should call a method in your backing bean that runs the authentication, and if successful, returns a success message. Your faces-config.xml should then have a navigation rule that will direct the user to the home page when login is successful.
If you're not sure how that works then I'd recommend getting a good JSF book or find a JSF tutorial online. Navigation rules are a basic part of JSF and would save you a huge amount of effort.
posted 8 years ago
Once the user logs in, he will be directed to a home page where he has to fill in a form which updates a table in the database in the back end. In that table I'm inserting the username across the user who has successfully logged in. That's why I'm using a session variable. Also, I can have tasks that can be done in a user-specific manner. If the user updates his personal details, then I can use the value of the session variable to query my database and update according to the user who has logged in.
But the exception which is coming up here is creating a problem, I mean it is trying to fetch a view which no longer exists. PFB the code in my backing bean.