Multiple Browser Tabs/Windows and NUMBER
We are developing an app in which we have to support multiple browser tabs/windows. Our setup: MyFaces 2.1, Spring, Orchestra
By default the org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION is set to 20. This means that if you open 21 tabs in browser, then the page in the first tab stops working - no view state for given view.
The same will happen if you open 2 tabs and request 21 view updates (ie. Ajax events) in the second tab. Then a click in the first tab will generate the same exception.
Is there a way around this? For example, is it possible to bind the view cache to conversation scope?
Set the view state saving method to client
instead of server
in web.xml
.
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
This way the entire view state will be saved (in serialized form, of course) in a hidden input field of the form instead of only the view state ID which refers the state in the session. This has the disadvantage that the page size may grow, but this should not be a major issue if you have partial view state saving turned on (which should be the default in JSF 2.0).