0

我将 primefaces 对话框用于弹出目的。但是每次打开时,整个屏幕都会自动刷新并且弹出窗口消失。

 < p:dialog id="dialog" header="Select different user" styleClass="atf-header"          widgetVar="dlg" appendToBody="true">
    <ui:include src="searchpopup.xhtml" />
      </p:dialog>
     <h:panelGroup>
     <h:outputLabel value="#{I18N['Create_Ticket_for_other_users']}" styleClass="atf-header" style="width:600px"></h:outputLabel>
    </h:panelGroup>
    <h:panelGroup id="search_section" layout="block"
       styleClass="atf-content-area atf-separarot-botton"  style="width:600px">   
         <h:panelGroup id="input_search_section" >
            <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()">
        </p:commandButton>
    </h:panelGroup>
</h:panelGroup>
4

1 回答 1

2

p:commandButton是提交整个表单的 AJAX 按钮(在 primefaces 中是默认设置)。向它添加type="button"属性,使其成为执行一些 JavaScript 的普通按钮(所谓的按钮)。我也看不到h:form标签在哪里。正如你所拥有appendToBody="true"的那样,你p:dialog是你没有封装p:dialog在里面的岸边h:form。如果有必要,你应该在h:form里面p:dialog,如果它不是在p:dialog外面移动h:form

于 2013-03-11T10:42:40.243 回答