使用 MyFaces CODI,我没有在不同的浏览器选项卡中获得不同的 windowid 值 - 为什么?
我使用 MyFaces CODI 是因为它允许我将 CDI 注释与 ViewAccessScoped 一起使用——非常适合这一点。问题是我发现我的应用程序打开的多个浏览器选项卡共享同一个 @ViewAccessScoped 支持 bean 实例。尴尬的。不受欢迎的。
在我的页面中,我有这样的内容:(
<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>
这实际上是通过 Primefaces p:dataGrid 组件运行的迭代完成的,但我试图在这里简化。)
单击任何链接都会导致浏览器打开一个新窗口(选项卡),它打开的 JSF 网页引用 @ViewAccessScoped 支持 bean。然而,它们都具有相同的 windowid,这与其中包含链接的主窗口相同。我认为这就是为什么他们都获得相同的支持 bean 实例。
有人知道如何解决这个问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个已知的浏览器问题。解决方案: http://old.nabble.com/- CODI--lazy-windowId-drop-script-p31654496.html
That's a known browser problem. Solution: http://old.nabble.com/-CODI--lazy-windowId-drop-script-p31654496.html