f:websocket in JSF 2.3

2019-03-02 06:38发布

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

I have added the JBoss JSF JAR:

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

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>

I get:

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

In IntelliJ IDEA the:

f:websocket

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

Where is the taglib for f:websocket?

1条回答
Viruses.
2楼-- · 2019-03-02 07:06

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.

From the very recent 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

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

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

You should then have JSF 2.3 and f:websockets

查看更多
登录 后发表回答