I have a problem due to server restrictions. The server allows only data under 25MB to be transmitted. The data that is supposed to be uploaded is 80MB+. I’m working with JSF, Primefaces and JavaEE.
My idea was to send the data in small packages via AJAX requests. The data is split into small enough chunks, but when I click the commandButton that is supposed to execute the AJAX as often as there are chunks, it sends the first data chunk with the correct content and then it only sends the content of the last chunk in every request.
My html looks like:
<h:form>
<input type="text" id="dataInput" name ="dataInput">
<h:commandButton action="#{ImportController.getTransmittedData()" id="button">
<p:ajax execute="dataInput"></p:ajax>
</h:commandButton>
</h:form>
And my js looks like:
startTransmittingData(){
for(let i=0; i<chunks.length(); i++){
document.getElementById("dataInput").value=chunks.get(i);
document.getElementById("button").click();
}
}
The ImportController only takes the data.
Is it just not possible to loop over a commandButton and get an instant reaction with AJAX? It alsow seems as if it’s ‘stuck’ somewhere. When the loop is done it starts sending the AJAX requests with the wrong content, since the input changed while looping over the chunk-List.
I tried changing the ajax but nothing made a difference.
Rike M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.