Domanda

Well I have created a web application using JSF 2.0. Everywhere I have used session scope bean and because of that I am facing problem. :( I will explain with below example.

I have list of users in dataTable. When I click on user, I see details of that user. Now when I right click on User A and click Open in new tab, I see details of User A in in new tab.

Now when I right click on User B and click Open in new tab, I see details of user B.

However when I go on tab (where user A details are there), and refresh that page, I see User B details.

How to overcome that so that if I refresh page, I will still see details of User A and not User B.

È stato utile?

Soluzione

Put the bean in the view scope instead.

When opening the details page, you should send a GET request, not a POST request. Use a normal <h:link> which passes the user identifier along as a request parameter by <f:param> and have a converter in the target view to convert it to the proper model value.

The session scope should be used for session scoped data only, such as logged-in user and its preferences.

See also:

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top