单击jsf中的按钮时如何显示弹出文本框和按钮?

时间:2015-04-21 12:37:13

标签: jsf primefaces

单击按钮时如何显示带有输入框和按钮的弹出对话框。这是我的实施......

                   <h:form name="calcDistanceform" widgetVar="selectedRowValuesDlg" style="margin:5px;" >

                                <h:inputText name="sourceDistance" value="#{searchController.sourceDistance}" /> 

                                <h:commandButton  value="Caliculate" class="popdistance" id="popdistancecalc" style="background-color:red;font-size:10px;font-weight:600">

                                   <p:ajax process="@this" update=""  listener="#{searchController.calculateDistance}"  />

                                </h:commandButton>

                </h:form>


                <p:commandLink value="Get Distance"  actionListener="#{searchController.onDistanceClick}"  oncomplete="PF('selectedRowValuesDlg').show();"  process="@this">        
                        <f:attribute name="clinic" value="#{clinic}"/>
                </p:commandLink>

1 个答案:

答案 0 :(得分:0)

使用p:dialog组件http://www.primefaces.org/showcase/ui/overlay/dialog/basic.xhtml

<p:dialog header="My Dialog" widgetVar="selectedRowValuesDlg">
    <h:form name="calcDistanceform" style="margin:5px;" >
         <h:inputText name="sourceDistance" value="#{searchController.sourceDistance}" /> 

         <h:commandButton value="Caliculate" class="popdistance" id="popdistancecalc" style="background-color:red;font-size:10px;font-weight:600" action="#{searchController.calculateDistance}" update="@form" />
    </h:form>
</p:dialog>

<p:commandLink value="Get Distance" actionListener="#{searchController.onDistanceClick}"  oncomplete="PF('selectedRowValuesDlg').show()"  process="@this">        
      <f:attribute name="clinic" value="#{clinic}"/>
</p:commandLink>
相关问题