与元素类型 "h:inputText" 关联的属性名称 "p:autofocus" 必须后跟“=”字符

Attribute name "p:autofocus" associated with an element type "h:inputText" must be followed by the ' = ' character

使用 passthrough 命名空间的 HTML 5 个属性似乎存在错误,即:

<h:inputText id="text1" p:autofocus p:placeholder="this is a placeholder text"></h:inputText> 

当我尝试 运行 Glassfish 中的页面时出现此错误:

Error Parsing /index.xhtml: Error Traced[line: 19] Attribute name "p:autofocus" associated with an element type "h:inputText" must be followed by the ' = ' character.

注意占位符属性工作正常,只是那些不需要指定值的属性 (=""),例如 autofocus 失败了。

这是已知错误吗?

不,这是由XHTML standard引起的:

XML does not support attribute minimization. Attribute-value pairs must be written in full. Attribute names such as compact and checked cannot occur in elements without their value being specified.

来自http://www.w3schools.com/tags/att_input_autofocus.asp

Differences Between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the autofocus attribute must be defined as <input autofocus="autofocus" />.