4和JSF 2.1、Tomcat6作为示例应用程序。当点击ui:composition中的图像时,我试图显示一个日志框。但它并没有被展示出来。如果我在没有使用ui:composition>的情况下运行它,它会工作得很好。
这是我的代码
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
</h:head>
<h:body>
<p:dialog id="dialog" header="Login" widgetVar="dlg">
<h:form>
<h:outputText value="hi"></h:outputText>
<!-- <h:panelGrid columns="2" cellspacing="5" >
<h:outputLabel value="OsName" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.osName}"></h:inputText>
<h:outputLabel value="OsFamily" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.osFamily}"></h:inputText>
<h:outputLabel value="OsDescription" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.osDescription}"></h:inputText>
<h:outputLabel value="OsGuid" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.osGuid}"></h:inputText>
<h:outputLabel value="MajorVersion" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.majorVersion}"></h:inputText>
<h:outputLabel value="minorVersion" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.minorVersion}"></h:inputText>
<h:outputLabel value="BuildVersion" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.buildVersion}"></h:inputText>
<h:outputLabel value="OsServicepack" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.osServicepack}"></h:inputText>
<h:outputLabel value="OsRevision" style="color:black"></h:outputLabel>
<h:inputText value="#{productBean.osRevision}"></h:inputText>
<h:commandButton value="Back" action="#{productBean.product}" styleClass="button1" ></h:commandButton>
<h:commandButton value="Next" action="#{productBean.productcustomer}" styleClass="button1" ></h:commandButton>
</h:panelGrid>
-->
</h:form>
</p:dialog>
<ui:composition template="/pages/templates/layout.xhtml">
<ui:define name="body" >
<h:form prependId="false">
<div class="widget">
<p:dataTable var="car" paginator="true" rows="10" >
<f:facet name="header">
List of Cars
</f:facet>
<p:columnGroup type="header">
<p:row styleClass="edit">
<p:column rowspan="3" headerText="Model" sortBy="Model" filterBy="Model" width="" />
<p:column rowspan="3" headerText="Year" sortBy="Year" filterBy="Year"/>
<p:column rowspan="3" headerText="Company" sortBy="Company" filterBy="Company"/>
<p:column rowspan="3" headerText="Color" sortBy="Color" filterBy="Color"/>
<p:column colspan="3" headerText="Actions" />
</p:row>
<p:row styleClass="edit">
<p:column><f:facet name="header"><h:outputLink onclick="showStatus()" title="Edit">
<p:graphicImage value="/images/b_edit.png" /></h:outputLink>
</f:facet></p:column>
<p:column><f:facet name="header"><h:outputLink onclick="showStatus()" title="Delete">
<p:graphicImage value="/images/b_drop.png" /></h:outputLink>
</f:facet></p:column>
<p:column><f:facet name="header"><h:outputLink onclick="dlg.show()" title="View">
<p:graphicImage value="/images/search-icon.png" /></h:outputLink>
</f:facet></p:column>
</p:row>
</p:columnGroup>
</p:dataTable>
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
Facelets跳过<ui:composition>
标记之外的所有内容,因此在这种情况下,对话框将不会出现在视图中。你还需要把它放在<ui:composition>
标签
hello尝试用布尔变量绑定渲染属性。由于