This question already has an answer here:
- How to choose the right bean scope? 2 answers
By default JSF appears to be very 'stateful'. I need to allow people to use our application with multiple tabs doing many things in different parts of the application.
I can't seem to find decent instruction on making this happen without a whole lot of re-engineering.
We do not currently use ICEfaces, but I just found this in the ICEfaces docs:
6.5.7. ICEfaces Portlets and Concurrent DOM Views
ICEfaces provides a feature called Concurrent DOM Views that controls whether or not the ICEfaces framework supports multiple views of a single application from the same browser. When running in a portlet container, ICEfaces needs to treat the separate portlets on a single portal page as distinct views so it is almost always necessary (and therefore safest) to have this parameter set to true.
Example 6.19. Enabling the ICEfaces Concurrent DOM Views feature in the WEB-INF/web.xml configuration file so that separate portlets on the same portal page are treated as distinct views
com.icesoft.faces.concurrentDOMViews true
So, I want to know whether this fabulous sounding functionality would possibly apply to my existing h:forms or whether it only works with ICEface components?
Can anyone offer any good advice to get a JSF app working in multiple tabs?
In JSF 2.0 you can use the view scope for this, annotable using @ViewScoped
. You can even define custom scopes.
See also:
I don't think View Scope will work here. The question is specifically about a multi-browser tab scenario and my understanding with View Scope is that there is still one separate state per view (not per tab). In other words if you have the same page open in multiple browser tabs then you are at risk for sharing state.
This is mentioned here: http://www.java.net/node/692109
It seems like there are only two solutions to this problem: 1. CDI/Seam conversation scope (or something like it where an extra id is added to requests) or 2. Just stick to request scope / stateless app.
MyFaces orchestra has a way of dealing with multiple tabs/windows (using the conversationContext
get parameter).
Use Seam with the JSF framework you want.
The conversation context is perfect for using different tab. Just start a new conversation on each tab. :)
Take a look at the Booking demo
来源:https://stackoverflow.com/questions/3202604/using-jsf-with-multiple-tabs-in-one-browser