在我的 JSF 项目中,我尝试使用 JSF 传递来利用与 HTML5 兼容的标记,而不是 PrimeFaces 组件。但它似乎会为空元素(如 hr、img、br)造成额外的结束标签,这会破坏我的布局。
这是我的完整代码。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>JSF Passthrough Test</title>
</head>
<body>
<form>
<input id="inputSearch" size="40" value=""/>
<button type="button" class="btn btn-default" jsf:id="searchbutton">
<span class="glyphicon glyphicon-search"></span> Find
</button>
</form>
<img src="http://i.imgur.com/atz81.jpg" alt="Cat + Unicorn"/>
</body>
</html>
这提供给浏览器的是一个额外的结束 img 标记,用于我在它之后的图像。(如果我在按钮之前移动图像,没问题。)
<img src="http://i.imgur.com/atz81.jpg" alt="Cat + Unicorn" />
</img>
我在这里有什么遗漏或做错了吗?谢谢。