目前,Page.xhtml包含Menubar.xhtml。 Page.xhtml似乎从Menubar.xhtml继承了menuBar.css。 Page.xhtml的内容是否可以继承menuBar.css但仅使用themeMain.css?
Menubar.xhtml
<?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">
<ui:composition xmlns="http://www.w3c.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:hx="http://www.ibm.com/jsf/html_extended">
<link type="text/css" rel="stylesheet" href="#{request.contextPath}/theme/primefaces-aristo/menuBar.css" />
<f:loadBundle basename="messages.MessageResources" var="msg" />
<tr>
<td><img border="0" src="/BelsizeWeb/theme/new_header.png"
width="930" height="85"></img></td>
</tr>
</ui:composition>
Page.xhtml
<h:head>
<title>Page</title>
<meta http-equiv="keywords" content="enter,your,keywords,here" />
<meta http-equiv="description"
content="A short description of this page." />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/theme/primefaces-aristo/themeMain.css" />
<f:view locale="en" />
<f:loadBundle basename="messages.MessageResources" var="msg" />
</h:head>
<h:body>
<h:form id="form1" enctype="multipart/form-data" prependId="false">
<ui:include src="../../theme/menubar.xhtml" />
</h:form>
</h:body>
答案 0 :(得分:0)
是保留<ui:composition>
标记,或者只是从Menubar.xhtml中删除样式表包含,因此<ui:include src>
标记只会嵌入所需的标记。不包括<ui:composition>
标记之外的所有内容。
现在,您在生成的html正文中包含样式表,结果不可预测。
希望这有帮助。
<ui:composition xmlns="http://www.w3c.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:hx="http://www.ibm.com/jsf/html_extended">
<f:loadBundle basename="messages.MessageResources" var="msg" />
<tr>
<td><img border="0" src="/BelsizeWeb/theme/new_header.png"
width="930" height="85"></img></td>
</tr>
</ui:composition>