This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I think it's similar to http request and session scope.
For example, if on 1 page you set a value on the request, and forward to another page and try to read that value off the request object, you won't get it. A new request object has been created for that page.
If you want to get values from a previous page you have to store those values on the session.
JSF has 4 scopes, None, Request, Session and Application.
So let's say you had a LoginBean, that only did some kind of verification, nothing else. You would put that into the request scope, and call it when the user clicked login, for example. but now let's say after logon, you want to say hello to that user, so he logs on as billybob, and upon successfully logon, you want to say hello billybob, And you want to read the username from the bean, you will have to put that bean into the session scope, so that it is not discarded when you forward to the welcome page.
Does this make sense?
Joined: Apr 16, 2007
Thanks for your reply.
yeah, that's what it looks like. But won't it cause too much load on the server? if practically, backing beans (with domain objects) are same for data input and display and all are stored in session?
Also, if we do request.setAttribute() in java method, we can access those values in normal jsp, but it seems like that is not happening in case of JSF.