0

When using JSF with a Java EE container (co-located), should you use a session scoped bean for session management or should you use a Stateful Session Bean.

What is the best practice?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
leo
  • 3,045
  • 5
  • 24
  • 23
  • 1
    Has already been answered by arjan: [session scoped managed bean vs stateful EJB](http://stackoverflow.com/questions/4842066/sessionscoped-managed-bean-vs-stateful-ejb/4843827#4843827). – BalusC Feb 04 '11 at 15:37

2 Answers2

1

It depends on the nature of your application, here are 2 examples:

To keep session at JSF bean (client-side): normally you are intended to store and retrieve some information less sensitive to be manipulated/supporting some client-side operation such as calculation, provide ID for records retrieval and everything is completely stateless, after user close browser everything will be wife off. Also considering less server load require in such approach.

To keep session at server side using Stateful Session Bean: normally you are intended to store and uses sensitive information for that particular session of the user, such as username, password etc... this part creates more load to the server as well as to be more secured.

Probably you might want to share more information what is the objective to be achieve otherwise the answers would never be accurate.

d4v1dv00
  • 971
  • 4
  • 10
  • 21
0

It is certainly dependent on the usage.

for example :
you want to hold the firstName, LastName of user who is logged In , session scope is suited. if you want the logged in users data over admin part put it in application scope it will be shared across application .

jmj
  • 237,923
  • 42
  • 401
  • 438