简体   繁体   中英

JSF 2.2 HTML5 Pass-through attributes

I am trying to use JSF 2.2 innovations html5 pass-through attributes feature.

Name-spaced attribute on the component tag working with m09 version.

<dependency>
   <groupId>org.glassfish</groupId>
   <artifactId>javax.faces</artifactId>
   <version>2.2.0-m09</version>
</dependency>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://java.sun.com/jsf/passthrough">
  <h:head>
    <title>HTML 5</title>
  </h:head>
  <h:body>
    <h:inputText p:placeholder="Enter text"/>    
  </h:body>
</html>

But do not work with newer versions.

The f:passThroughAttributes tag is working with newer versions.

Why?

You should use the following namespace :

xmlns="http://xmlns.jcp.org/jsf/passthrough"

Explanation:

The new namespace xmlns.jcp.org must be used for the new passthrough stuff for 2.2 (since this is new for 2.2). You can use the old (java.sun.com) or new (xmlns.jcp.org) namespace for the ui, h and f namespaces since we need to preserve compatibility. But I would encourage you to use the new namespace for everything going forward for 2.2.

Here is the JIRA reference : Passthrough attributes not working when used with prefixing the attribute with the shortname assigned to the http://java.sun.com/jsf/passthrough

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM