1 Reply Latest reply on Mar 29, 2012 10:12 AM by Sergio Angelo

    Ajax call to the result of long-running process

    al ex Newbie

      Hi, All.

      I have a problem with getting result of long-running process, it returns null when the process is in progress.

      I've tried to make like discribes here http://docs.jboss.com/seam/2.0.1.GA/reference/en/html/conversations.html#d0e5208


      I saw many topics in this forum, but didn't find any working example. Could you help me?...

      Here the example i try to make it work:


      I'm using Seam 2.2.0.GA.




      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
          <begin-conversation join="true"/>




                <a4j:poll id="poll"  enabled="#{someAction.enablePolling}" reRender="consoleOutput,poll" />
           <a4j:jsFunction name="startBuild" action="#{someAction.startBuild}" />
           <a4j:commandButton value="Start Build"  action="#{someAction.startPolling}" oncomplete="startBuild()" reRender="poll" />
           <h:outputText id="consoleOutput" value="#{someAction.consoleOutput}" escape="false"/>




      public class SomeAction {     
           private static final int SLEEP_SEC = 1000;
           private static final int ENTIRIES = 10;
           private boolean enablePolling;
           private StringBuffer buildOutputSb = new StringBuffer();
           private String consoleOutput;    
           public boolean isEnablePolling() {
              return enablePolling;
           public void setEnablePolling(boolean enablePolling) {
              this.enablePolling = enablePolling;
           public void startPolling(){
              this.enablePolling = true;
           public String getConsoleOutput() {
              return this.buildOutputSb.toString();
           public void startBuild(){
              this.buildOutputSb = new StringBuffer();
              //Stimulating the build process , which will output the log message to the buildOutputSb
              for (int i = 0; i < ENTIRIES; i++) {
                  try {
                  } catch (InterruptedException e) {
              this.enablePolling = false;


      I would be happy for any suggestions...