CIO*_*IOC 2 jsf html5 facelets jsf-2.2 passthrough-attributes
似乎使用passthrough命名空间使用某些HTML 5属性存在错误,即:
<h:inputText id="text1" p:autofocus p:placeholder="this is a placeholder text"></h:inputText>
Run Code Online (Sandbox Code Playgroud)
当我尝试在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.
Run Code Online (Sandbox Code Playgroud)
请注意,占位符属性可以正常工作,只需要不需要指定值(=""),例如autofocus失败.
这是一个已知的错误?
不,这是由XHTML标准引起的:
XML不支持属性最小化.属性 - 值对必须完整写入.如果没有指定值,则元素名称(如compact和checked)不会出现在元素中.
来自http://www.w3schools.com/tags/att_input_autofocus.asp
HTML和XHTML之间的差异
在XHTML中,禁止属性最小化,并且必须将autofocus属性定义为
<input autofocus="autofocus" />.