Question

Some sources indicate that it's possible to use non-obtrusive jsf:id attributes in a JSF2.2 page.

https://weblogs.java.net/blog/edburns/archive/2012/11/01/html5-friendly-markup-jsf-22 http://www.apress.com/9781430244257

The taglib descriptors use different urls.
From the weblog:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://java.sun.com/jsf">
<head jsf:id="head">

From the book:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://xmlns.jcp.org/jsf"> 
<head jsf:id="head>

However, while using the newest JSF2.2 implementation (2.2.0-m15), both urls for the tag descriptors are unreachable (CANNOT_FIND_FACELET_TAGLIB), resulting in a partially unparsed html page.

Where to find the correct urls for the jsf tag library? Is there some kind of index for those urls?

Was it helpful?

Solution 2

The latter is the correct definition. I don't think the head tag is used that way with JSF. Use the JSF html tag library.

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:jsf="http://xmlns.jcp.org/jsf">
    <h:head></h:head>
....

You typically use jsf:id for HTML5 input components. Refer to the Java EE 7 Tutorial section on HTML5/JSF pass-through for information and an example application.

OTHER TIPS

To use jsf:id use http://xmlns.jcp.org/jsf namespace. This is applicable for form input. It is not used on head tag. For example, the following code declares the namespace with the short name jsf:

        <html ... xmlns:jsf="http://xmlns.jcp.org/jsf"
         ...
       <input type="email" jsf:id="email" name="email"
       value="#{reservationBean.email}" required="required"/>

Here, the jsf prefix is placed on the id attribute so that the HTML5 input tag's attributes are treated as part of the Facelets page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top