Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tags from http://xmlns.jcp.org namespace do not render, while http://java.sun.com/jsf work fine

I have this:

<html 
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
>
<h:selectOneRadio>
    <f:selectItem value="1" itemValue="1" itemLabel="123"/>
    <f:selectItem value="2" itemValue="2" itemLabel="321"/>
</h:selectOneRadio>

And I get this:

<f:selectItem value="1" itemValue="1" itemLabel="123"></f:selectItem>
<f:selectItem value="2" itemValue="2" itemLabel="321"></f:selectItem>
<select name="j_idt5" size="1"></select>

Why are xmlns:f="http://xmlns.jcp.org/jsf/core" tags not rendered?

I'm using JBoss AS 7 on Netbeans 7.3.

like image 218
KorobOK Avatar asked Feb 15 '23 00:02

KorobOK


1 Answers

The new XML namespace domain http://xmlns.jcp.org in JSF taglib URIs is introduced in JSF 2.2 which is part of Java EE 7. JBoss AS 7 as being a Java EE 6 compliant application server does not ship with JSF 2.2 bundled, but with JSF 2.1. Therefore the new XML namespace domain does not work at all. Also the new JSF 2.2 specific features such as passthrough elements and attributes won't work at all.

You need to use the JSF 2.1 compatible XML namespace domain http://java.sun.com. Here's the complete set:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
>

I'm not sure why you attempted to use the new JSF 2.2 XML namespaces. Perhaps you incorrectly read a JSF 2.2 targeted tutorial (e.g. Oracle Java EE 7 tutorial) instead of a JSF 2.0/2.1 targeted one (e.g. Oracle Java EE 6 tutorial). Pay carefully attention that the versions match.

If you really intend to use JSF 2.2 on a JBoss server, then you should basically be upgrading the old JBoss AS 7 to its Java EE 7 compatible successor WildFly 8. Alternatively, manually upgrade the bundled JSF libraries of JBoss AS 7 to a newer version as instructed here: Upgrade JSF / Mojarra in JBoss AS / EAP / WildFly.

like image 125
BalusC Avatar answered Apr 28 '23 17:04

BalusC