f:websocket 在 JSF 2.3 中

f:websocket in JSF 2.3

我试图让 BalusC 的 JSF 2.3+ 示例 (How can server push asynchronous changes to a HTML page created by JSF?) 使用 JBoss WildFly 12.0.0.Final

我添加了 JBoss JSF JAR:

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

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

<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 Tag Library supports namespace: http://xmlns.jcp.org/jsf/core, but no tag was defined for name: websocket

在 IntelliJ IDEA 中:

f:websocket

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

f:websocket 的标签库在哪里?

f:websocket 自 JSF 2.3 起可用,尽管 Wildfly 12 包含 一些 JavaEE 8 功能,但它默认以 JavaEE 7 模式启动,即 'just' JSF 2.2.

从最近开始(编辑:撰写本文时 ;-))WildFly 12 release documentation

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

还有其他选项可以启用此功能。来自同一文档:

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

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) stop-embedded-server

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