Tim Holloway wrote:Somebody's been working with Struts, I think.
A session-scope object has a fairly long lifetime. Unlike request-scope objects, which are created and destroyed every time you submit a request, session objects, once created, live until the session itself is destroyed, either explicitly or because the session timed out due to inactivity. So no, you won't lose your "form bean" (or more accurately speaking, your Managed Bean named "form"). Therefore you can safely inject it into any bean of equal or shorter lifespan - meaning that session beans can be injected into other session beans and/or request beans, but request beans cannot be injected into session beans (JSF will throw an error, if you try).
Occasionally this restriction requires a little creativity. For example, you might need to inject in the other direction in order to satisfy these restrictions. That is, if you a have a request-scope object that needs to be processed by a session-scope object, you'd have to inject the session-scope object into the request-scope object, then have the request-scope object perform a callback on the injected object. That's not as awkward or unnatural as it may sound, just takes getting used to the Inversion of Control way of doing things. IoC isn't unique to JSF - the Spring Framework, for example is all about IoC.
xsunil kumar wrote:Can You describe me, what is your problem and what is the goal of this mapping. What finally you want to get from this type of mapping.
Tim Holloway wrote:After you invalidate the session, EVERYTHING below application scope should be wiped out.
However, request-scope objects have an even shorter lifespan. They get reconstructed for each HTTP request. Hence the name "request" scope.