0

I am having hard time understanding when and where to use scopes. I read through a lot on google, and I know what sessionscope, requestscope and all other scopes. But not clear enough in which type of class it should have sessionscope or request scope?

Once the user logs in with loginBean (session scoped) any other beans further, I am using after user logged-in should be in request scope or session scope?

If I have any logic validating, if user is in session or not and accessing other business login (that invoked by request from client browser), does it have to be in session scope or request scope.

I read this: http://balusc.blogspot.com/2011/09/communication-in-jsf-20.html#ManagedBeanScopes

and still lots of confusion in where exactly to use :(

Mike Laren
  • 8,028
  • 17
  • 51
  • 70
Bhavana k
  • 1
  • 1
  • 4
  • 1
    Session scope holds all the session related data, as the logged user, the selected language and any other values which are stored in the session (the shopping cart could be another one). Request scope has to do with what you're actually doing in the current request, for example, ask for a concrete list, order a product or upload your main picture (which will be processed from the request and stored in the session, that's why you can access session scope from narrower scopes). – Aritz Jun 16 '15 at 06:59
  • Thank you @Xtreme Biker. This makes some sense to me. – Bhavana k Jun 16 '15 at 17:10

0 Answers0