Questions asked by cascamorrishttps://answers.axonivy.com/questions/asked-by/516/cascamorris/?type=rssQuestions asked by <a href="/users/516/cascamorris" >cascamorris</a>enWed, 21 Jan 2015 10:44:11 -0500Real Time Progress bar with a blockUI doesn't work using primefaces with atmospherehttps://answers.axonivy.com/questions/1126/real-time-progress-bar-with-a-blockui-doesn-t-work-using-primefaces-with-atmosphere<p>I have a button and when I press on it, the method obtains data from the data base and show the records in a datatable. The action takes more than 1 minute and I want to show a progress bar (the time is variable)</p> <p>I found the solution in this page: <a href="http://answers.axonivy.com/questions/16/show-a-real-time-progress-bar-in-a-html-user-dialog">Show a real time progress bar in a Html User Dialog</a></p> <p>The problem is that I show the progress bar, but always is "0%". In the javascript function never enter. And I don't know if I'm doing something wrong.</p> <p>This is my XHTML: (I can't write the simbol 'is less than')</p> <pre><code>h:form id="formAllocate"&gt; p:panel id="panel" header="Realtime ProgressBar"&gt; p:commandButton id="btn" value="Start" actionListener="#{scheduleMB.startLongRunningProcess}"&gt; /p:commandButton&gt; /p:panel&gt; p:blockUI block="panel" trigger="btn"&gt; p:progressBar widgetVar="progressBar" style="width:300px" labelTemplate="{value}%"&gt; /p:progressBar&gt; span id="msg"&gt;&lt;/span&gt; /p:blockUI&gt; /h:form&gt; p:socket channel="/realtime" onMessage="handleProgress"&gt;&lt;/p:socket&gt; script type="text/javascript"&gt; function handleProgress(progressJson) { alert('begin'); var progressData = eval("(" + progressJson + ")"); progressBar.setValue(progressData.progress); $("#msg").text(progressData.msg); } /script&gt; </code></pre> <p>This is my Bean:</p> <pre><code>public void startLongRunningProcess(){ EventBus eventBus = EventBusFactory.getDefault().eventBus(); eventBus.publish("/realtime", "{ 'progress' : 10, 'msg' : 'Extract data'}"); list = getAuxService().findList(userSelected, initDate2, endDate2); } </code></pre> <p>In the web.xml:</p> <pre><code>servlet&gt; servlet-name&gt;Push Servlet&lt;/servlet-name&gt; servlet-class&gt;org.primefaces.push.PushServlet&lt;/servlet-class&gt; load-on-startup&gt;1&lt;/load-on-startup&gt; async-supported&gt;true&lt;/async-supported&gt; /servlet&gt; servlet-mapping&gt; servlet-name&gt;Push Servlet&lt;/servlet-name&gt; url-pattern&gt;/primepush/*&lt;/url-pattern&gt; /servlet-mapping&gt; </code></pre> <p>In my pom.xml I have this dependencies:</p> <pre><code>dependency&gt; groupId&gt;org.atmosphere&lt;/groupId&gt; artifactId&gt;atmosphere-runtime&lt;/artifactId&gt; version&gt;2.2.2&lt;/version&gt; /dependency&gt; dependency&gt; groupId&gt;org.roboguice&lt;/groupId&gt; artifactId&gt;roboguice&lt;/artifactId&gt; version&gt;2.0&lt;/version&gt; /dependency&gt; </code></pre> <p>I'm using primefaces 5.1, spring 3.2.5, hibernate 4.2.7, java 1.7, primefaces extension 3.0.0</p> <p>What I'm doing wrong???</p> <p>Thx for the help and answer.</p>cascamorrisWed, 21 Jan 2015 10:44:11 -0500https://answers.axonivy.com/questions/1126/real-time-progress-bar-with-a-blockui-doesn-t-work-using-primefaces-with-atmosphereprimepushjavaprimefaces