From Dam, I have uploaded a html and js files, For that dam js, I am posting the formdata to servelt using ajax call, the request will entered into the dopost method but request parameter are getting empty.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello everyone.
Thank you for taking the time to respond. I noticed an unusual behaviour: when we print in the logger.info, we get an empty text, while the same data is populating in the payload.
Quite strange behaviour
@kbitra1998 can you share code snippet using to read post request data in servlet?
check this out, if it solves your problem
javascript - Servlet in AEM, body in POST request is lost - Stack Overflow
Hello everyone.
Thank you for taking the time to respond. I noticed an unusual behaviour: when we print in the logger.info, we get an empty text, while the same data is populating in the payload.
Quite strange behaviour
@kbitra1998 You should be able to get value in logger.info as well, not sure how are you passing parameters to logger. Did you get a chance to print the same variables/parameters using system.out.println(for testing purpose)?
The mistake I have made is logger.info ("AEM" + parameter) it is printing in the logs. However, if I put logger.info("AEM", parameter) it is not printing in the logs.
Views
Replies
Total Likes
Check if formdata that you are passing are properly populated in your javascript. You can print that in console and check.
Sharing the code that works for me:
var formData = new FormData($("#formId")[0]);
Make sure in your form you have all your inputs set with name and value, name matching with the request parameter name that you fetch in the servlet.