【问题标题】:Attribute name "p:autofocus" associated with an element type "h:inputText" must be followed by the ' = ' character与元素类型“h:inputText”关联的属性名称“p:autofocus”必须后跟“=”字符
【发布时间】:2015-03-03 17:59:24
【问题描述】:

似乎使用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 失败了。

这是一个已知的错误吗?

【问题讨论】:

    标签: html jsf facelets jsf-2.2 passthrough-attributes


    【解决方案1】:

    不,这是XHTML standard引起的:

    XML 不支持属性最小化。属性值对 必须写完整。属性名称,例如 compact 和 checked 如果没有指定它们的值,就不能出现在元素中。

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

    HTML 和 XHTML 的区别

    在 XHTML 中,属性最小化是被禁止的,并且自动聚焦 属性必须定义为&lt;input autofocus="autofocus" /&gt;

    【讨论】:

      猜你喜欢
      • 2016-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-12
      • 2012-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多