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)

I found the solution in this page: Show a real time progress bar in a Html User Dialog

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.

This is my XHTML: (I can't write the simbol 'is less than')

h:form id="formAllocate">

    p:panel id="panel" header="Realtime ProgressBar">
        p:commandButton id="btn" value="Start"
            actionListener="#{scheduleMB.startLongRunningProcess}">
        /p:commandButton>
    /p:panel>

    p:blockUI block="panel" trigger="btn">
        p:progressBar widgetVar="progressBar" style="width:300px"
            labelTemplate="{value}%">
        /p:progressBar>
        span id="msg"></span>
    /p:blockUI>

/h:form>

p:socket channel="/realtime" onMessage="handleProgress"></p:socket>

script type="text/javascript">
    function handleProgress(progressJson) {
        alert('begin');
        var progressData = eval("(" + progressJson + ")");
        progressBar.setValue(progressData.progress);
        $("#msg").text(progressData.msg);
    }
/script>

This is my Bean:

public void startLongRunningProcess(){
    EventBus eventBus = EventBusFactory.getDefault().eventBus();
    eventBus.publish("/realtime", "{ 'progress' : 10, 'msg' : 'Extract data'}");

    list =
        getAuxService().findList(userSelected, initDate2,
            endDate2);
  }

In the web.xml:

servlet>
    servlet-name>Push Servlet</servlet-name>
    servlet-class>org.primefaces.push.PushServlet</servlet-class>
    load-on-startup>1</load-on-startup>
    async-supported>true</async-supported>
/servlet>
servlet-mapping>
    servlet-name>Push Servlet</servlet-name>
    url-pattern>/primepush/*</url-pattern>
/servlet-mapping>

In my pom.xml I have this dependencies:

dependency>
    groupId>org.atmosphere</groupId>
    artifactId>atmosphere-runtime</artifactId>
    version>2.2.2</version>
/dependency>

dependency>
    groupId>org.roboguice</groupId>
    artifactId>roboguice</artifactId>
    version>2.0</version>
/dependency>

I'm using primefaces 5.1, spring 3.2.5, hibernate 4.2.7, java 1.7, primefaces extension 3.0.0

What I'm doing wrong???

Thx for the help and answer.

asked 21.01.2015 at 10:44

cascamorris's gravatar image

cascamorris
(suspended)
accept rate: 100%

edited 22.01.2015 at 11:21

And which version of Axon.ivy is used?

(22.01.2015 at 17:12) Flavio Sadeghi ♦♦ Flavio%20Sadeghi's gravatar image

The solution can be found in the (duplicate) post in the PrimeFaces forum

link

answered 23.01.2015 at 09:28

cascamorris's gravatar image

cascamorris
(suspended)
accept rate: 100%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×52
×51
×5

Asked: 21.01.2015 at 10:44

Seen: 636,448 times

Last updated: 23.01.2015 at 09:28