0

I am working on j2ee6 project that extract emails from the web browserrs. I have a command Button that calls the extraction method after the user entered the emails number. Once the extraction is completed a confirm dialg shows up and displaying the number of emails extracted. Here is my xhtml code:

<h:form id="mainform">
            <p:panel id="panelform" header="Email Extractor"  >        
                <h:panelGrid id="formulaire" columns="2">  
                    <h:panelGroup id="formblock" layout="block" >
                        <p:panelGrid columns="2">                                                     
                            <p:outputLabel for="Emailsnbr" value="Enter the emails'number:" />  
                            <p:inputText  id="Emailsnbr"   type="number"  requiredMessage="Emails number is required"
                                          value="#{mailMB.number}" required="true" label="Emailsnbr">    
                            </p:inputText> 
                        </p:panelGrid>
                    </h:panelGroup>
                </h:panelGrid> 
                <p:commandButton   value="Extract" style="width: 12%;height: 100%" update="tableemails, :confirmPurchase, :confirmPurchaseTest, :mainform" id="extractbutton" ajax="true" widgetVar="ButtonExtract"
                                   actionListener="#{mailMB.searchEmails()}" 
                                   icon="ui-icon-disk" styleClass="ui-priority-primary"
                                   onstart="blockUIWidget1.show();" oncomplete=" blockUIWidget1.hide(); if (args &amp;&amp; !args.validationFailed) freeMails();" />    

                <p:dialog widgetVar="blockUIWidget1" modal="true" closable="false"  >  
                    <h:panelGrid columns="2">                      
                        <p:graphicImage url="pictures/loading_bar.gif" width="264" height="34" alt="animated-loading-bar"/>
                        <h:outputText value="Please wait..." style="white-space: nowrap;"/>  
                    </h:panelGrid>  
                </p:dialog>
            </p:panel>  
        </h:form>  
   <p:confirmDialog closable="false" style="position: absolute;  width: 50px; border-color: blue" id="confirmPurchaseTest"  message="Your Database was successfully created. And contains #{mailMB.number} Emails "  
                         appendToBody="true"                                                             
                         header="Get Emails List" severity="info" widgetVar="emailsList"> 
            <h:form>        
                <p:commandButton id="getEmails" style="width: 30%;height: 100%" value="Get Emails" oncomplete="window.location.href = '/Hitonclick/emailsList.xhtml'"  >
                    <f:event type="preRenderView" listener="#{mailMB.preRender}"/>
                </p:commandButton>
                <p:commandButton id="declineTest" style="width: 30%;height: 100%" value="Decline" onclick="deleteDialog.show();" />       
            </h:form>

Every thing works fine if i enter a small number. But if i enter a big number for exemple 600, the extraction time becomes long (it's logic have no problem with this) and the number displayed on the confirm dialog is 0 although the emails are successfully extracted when i checked them from the db. Is it related to ajax or what?? How can i fix this?

junior developper
  • 448
  • 2
  • 19
  • 40
  • What times of "long" are we talking about? Minutes? Hours? Also, are you modifying `mailMB.number` in your backing code in any way? – mabi Feb 06 '14 at 09:40
  • @mabi from 50 minutes and more. No am not modifying number in the bean . Plus if i extract 100 mails for exemple i get the right number in the confirm dialog – junior developper Feb 06 '14 at 10:03
  • I suspect a session timeout, then. IIRC, that's set to 30 minutes. Try the answers from [this question](http://stackoverflow.com/q/3118968/785663) to see if that's an issue. – mabi Feb 06 '14 at 10:12
  • @mabi My session-timeout in the web.xml is set to -1. What is IIRC ?? – junior developper Feb 07 '14 at 07:37
  • IIRC is an acronym for "if i recall correctly". I'm kinda out of ideas here, sorry. Maybe try breakpointing `@PostConstruct` and `@PreDestroy` methods for your bean to see if you lose the bean doing the actual work when running longer tasks. – mabi Feb 07 '14 at 08:42

0 Answers0