3

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?

NOTiFY
  • 1,255
  • 1
  • 20
  • 36
  • _"I have added the JBoss JSF JAR:"_ Where did you add it? Wildfly 12 itself already comes with this: https://mvnrepository.com/artifact/org.wildfly/wildfly-jsf/12.0.0.Final – Kukeltje Apr 16 '18 at 10:34
  • I added to my IntelliJ library in an attempt to get rid of the red highlighted: and error displayed when i hover over it: "Can't resolve symbol f:websocket". Don't include in my EAR as you rightly say it's in the WildFly 12.0.0.Final module javax.faces – NOTiFY Apr 16 '18 at 10:58
  • But is it (by accident?) in the war that is in the ear? – Kukeltje Apr 16 '18 at 11:10
  • Oh and Wildfly 12 by default uses JSF 2.2 if I read things correctly. You have to switch it to 2.3 which is the first version to contain `f:websocket` – Kukeltje Apr 16 '18 at 11:17

1 Answers1

7

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 (edit: at time of writing ;-)) 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

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • Great! And I don't even use WildFly 12 (yet, still on 11). Just did some creative googling and thinking. – Kukeltje Apr 16 '18 at 12:12