Search code examples
jsf-2myfacescodi

With MyFaces CODI, I am not getting different windowid values in different browser tabs -- why?


I am using MyFaces CODI because it allows me to use CDI annotations with ViewAccessScoped -- works great for that. The problem is that I have found that multiple browser tabs opened by my application are sharing the same instance of a @ViewAccessScoped backing bean. Awkward. Undesirable.

In my page I have something like this:

<h:link outcome="dispRecord"
      target="_blank"
      value="Click Here To Open New Window For Record 101" >
   <f:param name="recID" value="101" />
</h:link>
<h:link outcome="dispRecord"
      target="_blank"
      value="Click Here To Open New Window For Record 202" >
   <f:param name="recID" value="202" />
</h:link>
<h:link outcome="dispRecord"
      target="_blank"
      value="Click Here To Open New Window For Record 303" >
   <f:param name="recID" value="303" />
</h:link>

(this is really done with an iteration run by a Primefaces p:dataGrid component but I am trying to simplify here.)

Clicking on any of the links will cause the browser to open a new window (tab) and the JSF web page that it opens references the @ViewAccessScoped backing bean. However they all get the same windowid, which is the same as the main window with the links in it. I assume that is why they all get the same instance of the backing bean.

Anyone know how to fix this?


Solution

  • That's a known browser problem. Solution: http://old.nabble.com/-CODI--lazy-windowId-drop-script-p31654496.html