簡體   English   中英

無法以素面顯示對話框

[英]Not able to display the dialog box in primefaces

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>標記中

你好,通過將其與布爾變量綁定來嘗試渲染的屬性。 謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM