1

我有一个 jsf 页面,其中有一个弹出按钮,可打开以下对话框弹出窗口:

</h:form>
<p:dialog id="dialog" header="Select different user"
        widgetVar="dlg" appendToBody="true">

    <h:form id="form23">
        <h:panelGrid columns="2" cellpadding="5">
            <h:outputLabel for="username" value="Username:" />
            <p:inputText value="#{loginBean.username}" 
                id="username" required="true" label="username" />

            <h:outputLabel for="password" value="Password:" />
            <h:inputSecret value="#{loginBean.password}" 
                id="password" required="true" label="password" />

            <f:facet name="footer">
                <p:commandButton id="loginButton" value="Login" />
            </f:facet>
        </h:panelGrid>
    </h:form>
</h:form>

但是,它不是作为弹出窗口打开,而是显示在页面本身之外。该对话框位于主窗体之外。帮助!!


我试过了,但同样的问题仍然存在..下面是我修改后的代码..

<h:form id="create-ticket">
    <p:dialog id="dialog" header="Select different user" widgetVar="dlg" appendToBody="true">

    <h:panelGrid columns="2" cellpadding="5">
        <h:outputLabel for="username" value="Username:" />
        <p:inputText value="#{loginBean.username}" 
                id="username" required="true" label="username" />

        <h:outputLabel for="password" value="Password:" />
        <h:inputSecret value="#{loginBean.password}" 
                id="password" required="true" label="password" />

        <f:facet name="footer">
            <p:commandButton id="loginButton" value="Login" 
                />
        </f:facet>
    </h:panelGrid>

 </p:dialog>
     <h:panelGroup>
     <h:outputLabel value="#{I18N['Create_Ticket_for_other_users']}" styleClass="atf-header"></h:outputLabel>
    </h:panelGroup>
    <h:panelGroup id="search_section" layout="block"
       styleClass="atf-content-area atf-separarot-botton">   <!-- This is the section where we get the grey background -->
         <h:panelGroup id="input_search_section" styleClass="">
            <h:outputText id="name" value="Siddharth Mishra"    
            labelStyleClass="atf-label">
            </h:outputText>
        </h:panelGroup>
    <h:panelGroup styleClass="atf-right atf-inline-block">
        <p:commandButton id="btn_search" value="select different user"
            styleClass="atf-button-search" onclick="dlg.show();" type="button"
            >

        </p:commandButton>
    </h:panelGroup>

</h:panelGroup>

现在我只有一个表单,您可以看到弹出对话框部分+在 h:panelgroup 下调用弹出窗口的按钮。附加是表单当前外观的图像提前谢谢在此处输入图像描述

4

1 回答 1

2

您需要重组代码。

*不要将表格嵌套在其他表格中。

*您没有 p:dialog 的结束标签。

<h:form>    
    <p:dialog id="dialog" header="Select different user"
            widgetVar="dlg" appendToBody="true">

          //Content ex inputtext

    </p:dialog>

<p:commandButton value="Show Dialog" onclick="dlg.show();" type="button" />  
</h:form>
于 2013-03-05T08:56:08.840 回答