JSF 2.2 HTML5 Pass-through attributes

一个人想着一个人 提交于 2019-12-30 07:35:06

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/17003344/jsf-2-2-html5-pass-through-attributes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!