4和JSF 2.1,Tomcat6作为示例应用程序。当我点击ui:composition中的图像时,我试图显示一个dailog框。但它没有显示出来。如果我在不使用ui的情况下运行它:组合>它工作正常。
这是我的代码
<?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>
答案 0 :(得分:1)
Facelets会跳过<ui:composition>
标记之外的所有内容,因此在这种情况下,对话框根本不会出现在视图中。您还需要将其放在<ui:composition>
标记
答案 1 :(得分:-1)
你好通过将它与布尔变量绑定来尝试渲染的Property。 感谢