0

目前,Page.xhtml 包括 Menubar.xhtml。Page.xhtml 似乎从 Menubar.xhtml 继承了 menuBar.css。Page.xhtml的内容可以不继承menuBar.css而只使用themeMain.css吗?

菜单栏.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>

页面.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>
4

1 回答 1

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>
于 2013-06-17T10:32:44.260 回答