Java 如何在JSF中包含页面?
我是jsf新手,我想知道如何在没有“复制粘贴”的情况下重用其他.jsf页面 在.jsp中,我执行以下操作:Java 如何在JSF中包含页面?,java,jsp,jsf,Java,Jsp,Jsf,我是jsf新手,我想知道如何在没有“复制粘贴”的情况下重用其他.jsf页面 在.jsp中,我执行以下操作: // head.jsp <head> ... </head> // top.jsp <body> ... </body> Then i include them in my new .jsp // index.jsp <%@include file="head.jsp" %> <%@include file="top.
// head.jsp
<head> ... </head>
// top.jsp
<body> ... </body>
Then i include them in my new .jsp
// index.jsp
<%@include file="head.jsp" %>
<%@include file="top.jsp" %>
...
如何使用jsf实现这一点?
我试着这样做:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<ui:include src="components/head.xhtml" />
</h:head>
<h:body>
<ui:include src="components/top.xhtml" />
</h:body>
</html>
但是它不起作用
有什么想法吗
致以最良好的祝愿,
Valter Henrique。尝试在核心库中查找导入标记
我认为ui:include可能是用于facelets而不是普通的jsf。facelets是JSF2的默认视图技术,所以我在这里使用它的标记。确保你的路径是正确的-它们应该以webapp根开始,一个包含WEB-INF的根-并且确保包含的facelets包含包含的内容周围的标记。此标记之外的任何内容都将被忽略