在一个浏览器中使用具有多个选项卡的 JSF

发布于 2024-09-08 19:00:45 字数 726 浏览 2 评论 0原文

默认情况下,JSF 看起来非常“有状态”。我需要允许人们使用我们的应用程序,通过多个选项卡在应用程序的不同部分执行许多操作。

如果没有大量的重新设计,我似乎找不到合适的指导来实现这一点。

我们目前不使用 ICEfaces,但我刚刚在 ICEfaces 文档中发现了这一点:

6.5.7。 ICEfaces Portlet 和并发 DOM 视图

ICEfaces 提供了一个名为 控制的并发 DOM 视图 是否使用ICEfaces框架 支持单个视图的多个视图 来自同一浏览器的应用程序。 当在 portlet 容器中运行时, ICEfaces 需要单独对待 单个门户页面上的 portlet 为 不同的观点,所以它几乎总是 有必要(因此也是最安全的) 将此参数设置为 true。

示例 6.19。启用 ICEfaces 并发 DOM 视图功能 WEB-INF/web.xml 配置文件so 将同一 portlet 分开 门户页面被视为不同的 浏览次数

com.icesoft.faces.concurrentDOMViews 真的

所以,我想知道这个听起来很棒的功能是否可能适用于我现有的 h:forms 或者它是否只适用于 ICEface 组件?

任何人都可以提供任何好的建议来让 JSF 应用程序在多个选项卡中工作吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

故人的歌 2024-09-15 19:00:45

在 JSF 2.0 中,您可以使用视图范围来实现此目的,可以使用 @ViewScoped。您甚至可以定义自定义范围

另请参阅:

In JSF 2.0 you can use the view scope for this, annotable using @ViewScoped. You can even define custom scopes.

See also:

在风中等你 2024-09-15 19:00:45

我认为 View Scope 在这里不起作用。这个问题专门针对多浏览器选项卡场景,我对视图范围的理解是每个视图(而不是每个选项卡)仍然有一个单独的状态。换句话说,如果您在多个浏览器选项卡中打开同一页面,那么您就有共享状态的风险。

这里提到了这一点: http://www.java.net/node/692109

看起来像这个问题只有两种解决方案:1. CDI/Seam 对话范围(或类似的东西,在请求中添加额外的 id)或 2. 坚持请求范围/无状态应用程序。

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.

靑春怀旧 2024-09-15 19:00:45

MyFaces Orchestra 有一种处理多个选项卡/窗口的方法(使用 conversationContext 获取参数)。

MyFaces orchestra has a way of dealing with multiple tabs/windows (using the conversationContext get parameter).

分开我的手 2024-09-15 19:00:45

Seam 与您想要的 JSF 框架结合使用。

对话上下文非常适合使用不同的选项卡。只需在每个选项卡上开始一个新对话即可。 :)

观看预订演示

请不要使用Seam,它不受支持。按照此答案中所述使用 JSF 2.0 https://stackoverflow.com/a/3203670/4206

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

Please don't use Seam, it's not supported. Use JSF 2.0 as stated in this answer https://stackoverflow.com/a/3203670/4206

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文