Jsf 使用PF轮询实时更新列表大小

Jsf 使用PF轮询实时更新列表大小,jsf,primefaces,updates,ajax-polling,Jsf,Primefaces,Updates,Ajax Polling,在我的JEE应用程序中,我有一个电子邮件列表提取过程。我需要显示一个计数器,该计数器在向列表中添加邮件后递增。其想法是显示此列表的大小,并使用primeface poll每隔1秒更新一次。我是这样处理的: EmailsExtraction.xhtml: <h:body> <h:form> <h:panelGroup id="formblock" style="margin-top: 40px" layout="block" >

在我的JEE应用程序中,我有一个电子邮件列表提取过程。我需要显示一个计数器,该计数器在向列表中添加邮件后递增。其想法是显示此列表的大小,并使用primeface poll每隔1秒更新一次。我是这样处理的:

EmailsExtraction.xhtml:

<h:body>
    <h:form>
        <h:panelGroup id="formblock" style="margin-top: 40px" layout="block" >
            <p:panelGrid columns="2">
                <p:outputLabel for="Keyword" value="Keywords: " />  
                <p:inputText id="Keyword"   type="search" requiredMessage="Keyword is required" style="width: 600px"
                             value="#{mailMB.keyword}" required="true" label="Keyword">    
                </p:inputText> 
                  <p:outputLabel for="Emailsnbr" value="Emails amount:" />  
                <p:inputText  id="Emailsnbr"   requiredMessage="Emails number is required" style="width: 590px"
                              value="#{mailMB.number}" required="true" label="Emailsnbr"> 
                </p:inputText> 
            </p:panelGrid>
        </h:panelGroup>
        <p:spacer height="5px" />
        <p:commandButton   value="Start" style="width: 12%;height: 100%"  id="extractbutton" ajax="true" widgetVar="ButtonExtract"
                           actionListener="#{mailMB.searchEmailsRym()}" 
                           styleClass="ui-priority-primary"
                           onstart="blockUIWidget1.show();" oncomplete="play(); blockUIWidget1.hide(); if (args &amp;&amp; !args.validationFailed) freeMails();"> 
        </p:commandButton> 

    </h:form>

                            <p:dialog  widgetVar="blockUIWidget1" header="Hitonclick"  modal="true" resizable="false" closable="false"  >                                
                                <table border="0" style="width: 500px">
                                    <tbody > 
                                        <tr>  
                                            <td>
                                                <p:graphicImage url="pictures/loading81.gif" width="200" height="200" alt="animated-loading-bar"/>
                                            </td>
                                            <td>
                                                <h:form >
                                                    <p:outputLabel value="#{mailMB.count}" id="countOutPut"/>
                                                    <p:poll interval="1" update="countOutPut" listener="#{mailMB.increment}"/>

                                                    <div id="countdown_text">0</div>
                                                    <br></br>
                                                    <p:commandButton ajax="false" style="width: 100px;height: 40px" actionListener="#{mailMB.abortSearch()}"   value="Cancel" styleClass="ui-priority-primary" title="Cancel" oncomplete="clearForm('formcounter'), clearForm('searchForm')"/>  

                                                </h:form>
                                            </td>
                                        </tr>
                                        <div align="right">                                    
                                        </div>
                                    </tbody>
                                </table>
                            </p:dialog>
</h:body>

但是计数值没有更新。

@user1983983邮件提取方法工作得很好,所有邮件都成功地保存在我的数据库中,我只有一个问题,就是实时取消列表大小。是否有另一个表单包装
命令按钮和
对话框
?检查浏览器控制台,查看是否有请求传出,以及是否检查传入的响应。commandButton由主窗体包装,带有一些输入文本,对话框在一旁。@Susanna-一个
不应包含在另一个
中,即没有嵌套的forms@kolossus我的xhtml页面中没有嵌套表单。有两种形式:第一种形式包含InputExt和commandButton,第二种形式在模态对话框中。
 private int count=0;
 public void increment(){
 count=mails.size();
 }
 // count getter & setter