Hello!
Basically I have a .jsp let's call card.jsp so there is a form where the user can upload text and pdf, image, audio, so I wrap all those info, in a form created by a aux.js and send it to the same card.jsp using POST method and enctype = 'multipart/form-data'
So when I try to get the params in order to send the request to a controller, all the params are null
On local machines this is fine and its working, when the .war is uploaded to Elastic Beanstalk and all the forms with multipart/form-data are not working well (no error logs exist and no errors on console, simply just refresh the site)
this is the piece of code .jsp
if( request.getParameter("sendRequest") != null && Boolean.parseBoolean(request.getParameter("sendRequest")) ){
List<Part> archivos = new ArrayList<Part>();
for( Part part : request.getParts() ){
if( part.getSubmittedFileName() != null && part.getSubmittedFileName() != "" ){
archivos.add( part );
}
}
sendRequest = requestController.crearRequest(
request.getParameter("requestType"),
request.getParameter("description"),
Integer.parseInt(request.getParameter("idTaskCard")),
archivos);
}
The .js
const urlParams = new URLSearchParams(window.location.search);
const formularioAEnviar = document.createElement('form');
formularioAEnviar.action = 'job_card.jsp?idTaskCard=' + urlParams.get('idTaskCard');
formularioAEnviar.method = 'POST';
formularioAEnviar.style = 'display: none';
formularioAEnviar.enctype = 'multipart/form-data';
const requestType = document.createElement('input');
requestType.type = 'text';
requestType.value = typeRequest.value;
requestType.name = 'requestType';
const text = document.createElement('input');
text.type = 'text';
text.value = description.value;
text.name = 'description';
const action = document.createElement('input');
action.type = 'checkbox';
action.checked = true;
action.value = true;
action.name = 'sendRequest';
formularioAEnviar.appendChild(requestType);
formularioAEnviar.appendChild(text);
formularioAEnviar.appendChild(action);
const inputs = document.querySelectorAll('input[type="file"].d-none');
inputs.forEach( input => {
formularioAEnviar.appendChild(input);
} );
document.body.appendChild(formularioAEnviar);
formularioAEnviar.submit();
as extra data: I have cnofigured the https for my domain, and from that URL my request are made