in a jsf 2.2 application, there is page called test.xhtml that take a paramater called ‘id’ , for example test.xhtml?id=200 . The page is backed by a CDI Session bean named ‘TestBean’. The page has this code to load data:
<f:metadata> <f:viewAction action="#{testBean.redirectNoParameters}"></f:viewAction> </f:metadata> Now based on the id, the application load a set of fields in the session bean with the right values.
public String redirectNoParameters() { //Code… //Load fields test = testDao.find(id); //Code… } Till now is all good.
Except that when the user opens a new tab in the browser and specify a DIFFERENT id, for example test.xhtml?id=300 . the Session bean override the current values of the previous parameter 200, with the new id 300 values.
So my question is how can I use a session bean and deal with many tabs with different parameters? How can I have a session bean for each tab? If this is not possible than what solution do people use for this kind of scenario ? Thanks.