有没有办法将 html 文件的内容插入到 Facelet 模板中? Facelets 标签不起作用,因为它仅用于包含 Facelet 内容。
换句话说,我正在寻找相当于 JSP include 指令的 Facelets<%@ include file="..." %>
.
我可能不明白你需要什么,但是<ui:include>
不限于facelets内容,您可以根据它插入有效的xhtml这个链接 http://www.jsftoolbox.com/documentation/facelets/10-TagReference/facelets-ui-include.html.
考虑以下 Facelets 文件 (test.jsp):
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<f:view>
<h:outputText value="Text outside include"/>
<ui:include src="testinclude.html"/>
</f:view>
</body>
</html>
以及以下 HTML 文件 (testinclude.html):
<h2>Text from included page</h2>
它在页面中正确包含 HTML 内容。这也适用于使用时<ui:include>
在 Facelets 模板中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)