Hi Marcus, Dealing with multiple windows/tabs is a real pain.
As Andreas notes, each tab always has the same cookies (in all browser types), so any cookie-based session stuff will mean each tab has the same http session. It is possible when encoding the sessionId in the url, but there are still traps. For example, links that navigate within your app all need to have the sessionId encoded within them. But then if someone right-clicks on a link in a page and chooses "open in new tab", then the new tab will have the same sessionId value in the url, so again the two tabs are using the same session and conflicts occur. But do you really want separate http sessions anyway? Login details are normally held in the session, so if your app needs a login, then the user must log in separately in each tab. What would be much more useful in most cases is the ability for webapps to tell windows apart, and create copies of specific data structures on a per-window basis. But there is really no good way to do this; the http protocol just does not provide enough data to tell which window a request is coming from. Multi-tab applications *can* work if you: (a) use JSF client-side-state (b) do not use *any* session-scoped beans, ie use request-scoped objects only. It's really painful to work in this mode, though, for anything but trivial apps. I'm not aware of any good solution. Note that this is not a JSF-specific problem; I would expect that all webapps have the same issue. Re your original "concurrent modification" problem with Trinidad. You could add a servlet filter to your app which fetches an object from the user session, then runs the request while holding a lock on that object (ie calls Filter.doFilter within a synchronized block). This is a fairly common pattern to prevent concurrent requests by the same user. That will prevent the initial problem you saw, which is due to two threads accessing the same object at the same time. But if you use any session-scoped variables, then there will still be more subtle bugs around.. Regards, Simon Hoehmann, Andreas schrieb: > Hello Markus, > > you can have "unique" sessions only with url-encoded-session-handling. > If you use cookies, then the browser will use the same session-cookie > for each tab. > I guess the exception occured if facelets adds automatically new > childrens for some ui-components. This happend asyn in many tabs but > will change the same > objects on the server ... but only a idea ... i'm sure other people > can tell more about this :) > > Regards > Andreas > > ------------------------------------------------------------------------ > *Von:* Döring Markus [mailto:[EMAIL PROTECTED] > *Gesendet:* Dienstag, 6. Mai 2008 09:29 > *An:* MyFaces Discussion > *Betreff:* [Trinidad] ConcurrentModification > > Hi List, > > I have a page that shows a <tr:table>. > > This table refreshs with a <tr:poll> > > > > <tr:poll id="tablePoll" interval="5000" /> > > > > <tr:table rows="20" value="#{tableController.scores}" var="data" > id="scoreTable" partialTriggers="tablePoll"> > > … some columns and stuff > > </tr:table> > > > > So far everything works fine, but when I have multiple tabs open > in Firefox showing the same page, I get the exception attached below. > > This is not critical because it’s not a use case for our > application, but I’m trying to understand what happens here. > > Also I’ve noticed that the session is the same across multiple > tabs. Is there some way to get a new session for every browser tab > or is this browser specific? > > > > I’m using: > > Facelets 1.1.14 > > MyFaces 1.1.5 > > Trinidad 1.0.3 > > JBoss 4.2.2 GS > > > > Hope someone can have a look at this and help me understanding how > everything works. > > Thanks > > > > best regards > > Markus Döring > > TCC Products GmbH > > > > > > > > *Von:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > *Gesendet:* Montag, 5. Mai 2008 18:41 > *An:* PEN > *Betreff:* DPS Error 10.6.65.9 > > > > ------------------------------------------------------------------------ > > Log session start time Mon May 05 18:40:43 CEST 2008 > > *Time* > > > > *Thread* > > > > *Level* > > > > *Category* > > > > *Message* > > 6866296 > > > > http-0.0.0.0-8080-1 > > > > *ERROR* > > > > facelets.viewhandler > > > > Error Rendering View[/golf/score.xhtml] > > java.util.ConcurrentModificationException > at > java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449) > > at java.util.AbstractList$Itr.next(AbstractList.java:420) > at > > org.apache.myfaces.trinidad.component.UIXComponentBase.getFacetsAndChildren(UIXComponentBase.java:586) > > at > > com.sun.facelets.tag.jsf.ComponentSupport.findChildByTagId(ComponentSupport.java:114) > > at > com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:128) > > at > > com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) > > at > > com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314) > > at > com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169) > > at > > com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) > > at > > com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314) > > at > com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169) > > at > > com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119) > > at > com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49) > > at > com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25) > > at > com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248) > at > com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294) > at > com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273) > at > > com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:144) > > at > com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:60) > at > > com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) > > at > > com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314) > > at > com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169) > > at > com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109) > at > > com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314) > > at > com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169) > > at > com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49) > > at > > com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) > > at > com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25) > > at > com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95) > at > com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:509) > > at > > com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:552) > > at > > org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182) > > at > > org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41) > > at > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132) > > at > javax.faces.webapp.FacesServlet.service(FacesServlet.java:140) > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:253) > > at > > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:210) > > at > > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:164) > > at > > org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) > > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > de.tccproducts.dps.web.utils.lifecycle.ExceptionFilter.doFilter(ExceptionFilter.java:40) > > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) > > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) > > at > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) > > at > > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) > > at > > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) > > at > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > > at > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > > at > > org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) > > at > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > > at > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) > > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) > > at > > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) > > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) > > at java.lang.Thread.run(Thread.java:595) > > >

