0

I have a JSF/Primefaces page where I display the content of a table. In this table there are the results of a timer which tests every 15 minutes the accessibility of some related services. I also have a refresh button beneath the table which starts the test directly. The tests for some services may take very long and the page doesn't freeze while testing.

I want to know, if it would be possible to start those test asynchronous all paralell and the page shows if a test for a service ist still running, or if it has a result.

I know it could be difficult for a table but if you think it is too complicatet than it would be nice if it would be possible to show that the test-function is still running.

Simplified Code:

<h:form id="statusfrm">
  <div class="card">
    <p:dataTable var="sys" value="#{statushandler.availableList}"
      showGridlines="true" size="small">
        <p:column headerText="System">
          <h:outputText value="#{sys.systemName}" />
        </p:column>
        <p:column headerText="Verfügbarkeit">
          <h:outputText value="#{sys.availability}" />
        </p:column>
        <p:column headerText="Letzte Prüfung">
          <h:outputText value="#{sys.lastUpdate}" rendered="#{not sys.requestPending}"/>
          <h:outputText value="Pending..." rendered="#{sys.requestPending}"/>
        </p:column>
      </p:dataTable>
    </div>
    <p:commandButton value="Neu laden" icon="pi  pi-refresh" 
      actionListener="#{statushandler.refreshParameter}"/>
</h:form>

And in the statushandler

    public String refreshParameter() {
        Async: Interface1.checkSystem();
        Async: Interface2.checkSystem();
        Async: Interface3.checkSystem();
        Async: Interface4.checkSystem();
        return null;
    }

The objective is that everytime the user returns to the page with the table the system knows that there are pending requests for some systems.

But I will try also the solution with @Inject @Push this also looks useful.

  • Could you please add a simplified version of your code and where you want to add asynchronous calls? – Ahmed HENTETI Apr 03 '21 at 20:51
  • Does this answer your question? [How can server push asynchronous changes to a HTML page created by JSF?](https://stackoverflow.com/questions/3787514/how-can-server-push-asynchronous-changes-to-a-html-page-created-by-jsf) – Jasper de Vries Apr 04 '21 at 08:54

0 Answers0