JSF 2.3 中的 f:websocket [英] f:websocket in JSF 2.3

查看:12
本文介绍了JSF 2.3 中的 f:websocket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取 BalusC 的 JSF 2.3+ 示例(服务器如何将异步更改推送到由 JSF 创建的 HTML 页面?) 使用 JBoss WildFly 12.0.0.Final 工作

I trying to get BalusC's JSF 2.3+ example (How can server push asynchronous changes to a HTML page created by JSF?) working using JBoss WildFly 12.0.0.Final

我添加了 JBoss JSF JAR:

I have added the JBoss JSF JAR:

jboss-jsf-api_2.3_spec-2.3.3.SP1.jar

然而,当我尝试显示我的 XHTML 页面时:

However when I try and display my XHTML page which has:

<h:form>
    <f:websocket channel="push">
        <f:ajax event="updateNotifications" render=":panelGridSelect" />
    </f:websocket>
</h:form>

我明白了:

javax.faces.view.facelets.TagException:/enterProduct.xhtml @61,45标签库支持命名空间:http://xmlns.jcp.org/jsf/core,但没有为名称:网络套接字

javax.faces.view.facelets.TagException: /enterProduct.xhtml @61,45 Tag Library supports namespace: http://xmlns.jcp.org/jsf/core, but no tag was defined for name: websocket

在 IntelliJ IDEA 中:

In IntelliJ IDEA the:

f:websocket

显示为红色,好像找不到?

is shown in red, as though it can't find it?

f:websocket 的标签库在哪里?

Where is the taglib for f:websocket?

推荐答案

f:websocket 从 JSF 2.3 开始可用,虽然 Wildfly 12 包含一些 JavaEE 8 特性,它默认情况下以 JavaEE 7 模式启动,即只是"JSF 2.2.

f:websocket is available since JSF 2.3 and although Wildfly 12 contains some JavaEE 8 features, it by default starts in JavaEE 7 mode which is 'just' JSF 2.2.

来自最近的(撰写本文时;-))WildFly 12 发布文档

From the very recent (edit: at time of writing ;-)) WildFly 12 release documentation

默认情况下,WildFly 12 以 EE7 模式启动.为了使用这些新功能,您必须启用 EE8 预览模式.这可以通过在启动期间传递 ee8.preview.mode 属性来完成:

By default WildFly 12 launches in EE7 mode. In order to use these new capabilities you have to enable EE8 preview mode. This can be accomplished by passing the ee8.preview.mode property during startup:

./standalone.sh -Dee8.preview.mode=true

还有其他选项可以启用此功能.来自相同的文档:

There are other options too to enable this. From the same docs:

或者,这可以通过使用新的 standalone-ee8.xml 配置启动服务器来实现,该配置仅在配置中包含该属性.

Alternatively, this can be achieved by launching the server using the new standalone-ee8.xml configuration, which simply includes the property in the config.

./standalone.sh -c standalone-ee8.xml

CLI 还可用于修改现有配置以添加此属性.例如:

The CLI can also be used to modify the existing configuration to add this property. For example:

embed-server --admin-only=true/system-property=ee8.preview.mode:add(value=true)停止嵌入式服务器

然后你应该有 JSF 2.3 和 f:websockets

You should then have JSF 2.3 and f:websockets

这篇关于JSF 2.3 中的 f:websocket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆