Multiple browser / Windows tabs and NUMBER_OF_VIEWS_IN_SESSION

We are developing an application in which we must support several browser tabs / windows. Our setup: MyFaces 2.1, Spring, Orchestra

By default, org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION is set to 20. This means that if you open 21 tabs in the browser, the page on the first tab stops working - there is no view state for this view.

The same thing happens if you open 2 tabs and ask 21 to view updates (i.e. Ajax events) in the second tab. Then clicking on the first tab will throw the same exception.

Is there any way around this? For example, is it possible to bind the viewing cache to the conversation area?

+7
source share
1 answer

Set the method for saving the client view state instead of server in web.xml .

 <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> 

Thus, the entire state of the view will be saved (in serialized form, of course) in a hidden form input field, and not just in the identifier of the state of the view, which refers to the state in the session. This has the disadvantage that page size can increase, but this should not be a serious problem if you enable partial saving of view state (this should be the default value in JSF 2.0).

See also:

+3
source

All Articles