JSF and Database Access
Hi all,
I have a page which uses a backing bean set up for request scope. When the page is first loaded, the backing bean is instantiated, and in its constructor I load data from a database. Because the bean is in request scope, when the user submits the for to do whatever, the backing bean is re-instantiated, so I call the database again.
For performance reasons this isnt so hot, so I change the bean to session scope. But lets say the user navigates away from the page to some other part of the webapp. Then later on, they come back to the page with results from the database. Because the bean is in the session, its constructor is not called and so I dont refresh the database results. So I have to implement a button or link so that the user can click, which calls an action where i refresh the data.... But that is not logical to the user. When they click the original link to this page they are expecting updated results. Same is true if they hit the refresh button!!
A Microsoft Webforms style isPostBack variable or method would deal with this problem brilliantly, but Ive read lots of posts saying that JSF doesnt offer anything like this...
So what I am supposed to do in this scenario?
Ant

