jsf - Updating view during method execution -
i've been struggling while, here situation: have method performs long operation takes several minutes execute, method triggered commandbutton, when user clicks on want start showing(in real time) info him application doing.
here i've done far:
managedbean:
@managedbean @viewscoped public class mbean implements serializable { public string message; public void startlongprocess(actionevent ev) { step1(); message = "step 1 finished!"; requestcontext.getcurrentinstance().update("msg"); step2(); message = "step 2 finished!"; requestcontext.getcurrentinstance().update("msg"); step3(); message = "step 3 finished!"; requestcontext.getcurrentinstance().update("msg"); } ... }
xhtml:
<p:commandbutton actionlistener="#{mbean.startlongprocess}" ajax="true" /> <h:panelgroup id="msg"> <h:outputtext value="#{mbean.message}" /> </h:panelgroup>
in illustration i'm performing 3 step operation shows different message after finishing each step, problem message not beingness updated on view during method execution, update occurs after whole process finished.
does knows how create update in real time?
jsf jsf-2 primefaces jsf-2.2
No comments:
Post a Comment