I need your assistant in controlling the sequence of firing two java methods. In the JSF Form, I am having a commandLink that calls a method "GeneratePDF" and it will allow the user to download a PDF file. Later on a second call to a method "UpdateDataTable" that will run a SQL statement and then it will update the dataTable in the JSF form.
In the below code the second method "UpdateDataTable" is not called and the only method which is called is the "GeneratePDF". The code is:
<p:commandLink id="exporter" actionListener="#{exstaff.GeneratePDF}" ajax="false" oncomplete="updateremote()">
<h:graphicImage name="/images/PDF.png" alt="Export to PDF"/>
<p:fileDownload value="#{exstaff.pdfFile}"/>
</p:commandLink>
<p:remoteCommand id="updateremote" value="updateremote" actionListener="#{exstaff.UpdateDataTable}"/>
I tried to change the onComplete to onSuccess, but unfortunately the UpdateDataTable method is not called. Also, I tried the onClick and it will fire first the UpdateDataTable method and then the GeneratePDf method. But in my case, I want to fire the GeneratePDF and then the UpdateDataTable .