jsf - Need to update inbetween action in primefaces -


in scenario using poll, having 2 output text field render option showing data "waiting refresh" , "refresh happened" , when poll action starts need show "waiting refresh" , collect data end ,it may take few (seconds or minutes or hour) after getting data need update "refresh happened" poll action ends cycle every 30 seconds.how this ?

**viewer java class :**  public string pollaction()     {         pollcountrendered = false;       requestcontext.getcurrentinstance().update("viewerformid:headerid");             requestcontext.getcurrentinstance().update("viewerformid:containerid");             try             {                 thread.sleep(5000);             }             catch (interruptedexception ex)             {                 system.out.println(ex);             }             pollcount++;             system.out.println("poll action");             pollcountrendered = true;             requestcontext.getcurrentinstance().update("viewerformid:headerid");             requestcontext.getcurrentinstance().update("viewerformid:containerid");             return null;         }  **xhtml :**      <p:panel id="containerid">     <h:panelgrid columns="1"id="headerid"                                      cellpadding="3"                                      cellspacing="3">                             <h:panelgrid id="refreshid"                                          columns="3"                                          title="refresh status"                                          cellpadding="3"                                          cellspacing="3"                                          style="height: 3em;border-radius:20px;font-weight: bold;">                                  <h:outputtext id="refreshinid"                                               value="refresh in : "                                               style="font-size:1.6em !important;font-family:message-box;font-weight:bold;border:none;background:none;"/>                                  <h:outputtext id="refreshcountid"                                               value="waiting refresh"                                                rendered="#{viewer.pollcountrendered}"                                               style="text-align: center;                                               position: relative;top: 1px;                                               font-size: 1.6em;"/>                                  <h:outputtext value="refresh happened"                                                rendered="#{not viewer.pollcountrendered}"                                               style="text-align: center;                                               position: relative;top: 1px;                                               font-size: 1.6em;"/>                              </h:panelgrid>                         </h:panelgrid>      <div>                     <h:form>                         <p:poll id="pollid" widgetvar="pollid"                                   interval="30"                                   autostart="#{viewer.pollstart}"                                 stop="#{viewer.pollstop}"                                 listener="#{viewer.pollaction}"                                 update="@([id$=pollid]),@([id$=headerid])" >                         </p:poll>                         </div>  </p:panel> 

you question need more explanation us. let me try give answer. follow link primeface pool.

in code can update panel <p:panel id="containerid"> in update="containerid". can increase interval interval="3".

this poll update panel , panel display latest value, , output component render according.

note: tag question "jsf" more user can view question.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo