I am sending some data from my react app through Axios to my backend on Eclipse through servlets. My POST request has the right payload and even when I inspect the request with the code request.getReader().lines().collect(Collectors.joining(System.lineSeparator()))
, I get the entire contents of the request. It's a JSON format:
{"business_code":"90","number":"90","date":"2022-01-10"...
But when I try to get the value from any of the fields, it stores a null string and my numerical fields then throw an exception. Null string:
System.out.println("Bizz Code" + request.getParameter("business_code"));
Bizz Codenull
I don't understand why I am getting null when everything is actually there. Why is this happening?