放置<角色>在Facelets组成中的消息显示消息“此处不允许属性角色". [英] Putting <a role> in Facelets composition shows message "Attribute role is not allowed here"
问题描述
我刚刚尝试使用引导程序设置我的jsf项目.一切正常,除了添加包含"role
"属性的引导程序模板时.我收到一条消息,提示此处不允许使用角色角色
I just tried to setup my jsf project with bootstrap. Everything works fine except that when I added a bootstrap template that includes the "role
" attribute. I get a message that says Attribute role is not allowed here
我对设计不满意,我将更多的精力放在后端上,所以我真的需要使用引导程序.
I'm not good with design and I'm focusing more with the backend so I really need to use bootstrap.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:composition>
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="..." alt="..."/>
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
</div>
</div>
</div>
</div>
</ui:composition>
</html>
我无法弄清楚为什么所有其他标签和属性都被识别后,它不会读取该属性.
I can't figure out why it won't read that attribute when all other tags and attributes are recognized.
任何可能的解决方案?
Any possible solution?
谢谢.
推荐答案
您的文档类型错误. role
属性是HTML5(ARIA)的一部分,而不是XHTML 1.0.
Your doctype is wrong. The role
attribute is part of HTML5 (ARIA), not XHTML 1.0.
相应地修复文档类型.
<!DOCTYPE html>
您的编辑器(IDE)仅基于doctype验证文档.这不是JSF也不是Bootstrap的特定问题.这与基本HTML有关.
Your editor (IDE) is just validating the document based on doctype. This is not a JSF nor Bootstrap specific problem. This is related to basic HTML.
顺便说一句,在Facelets合成中,您实际上实际上严格不需要XML序言或doctype.无论如何,这些都将被Facelets忽略.以下内容应能很好地发挥作用:
By the way, in Facelets compositions you actually don't strictly need a XML prolog nor doctype. Those will be ignored by Facelets anyway. Below should work as good in its entirety:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
>
<!-- Content here -->
</ui:composition>
另请参见:
- <!DOCTYPE> ;在JSF中查看部分? HTML5或XHTML?
- JavaServer Faces 2.2和HTML5支持,为什么仍使用XHTML
- 如何包含另一个XHTML JSF 2.0 Facelets在XHTML中使用HTML?
- How should a <!DOCTYPE> section look in JSF? HTML5 or XHTML?
- JavaServer Faces 2.2 and HTML5 support, why is XHTML still being used
- How to include another XHTML in XHTML using JSF 2.0 Facelets?
See also:
这篇关于放置<角色>在Facelets组成中的消息显示消息“此处不允许属性角色".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!