0

I'm getting a String value from an HttpServletRequest with the method getParameter with the prupose to parse it to Integer.

This value can be a "null" String if the value is not setted in the front-end but when I try to compare it the result is always false

Boolean.toString(request.getParameter("parameter") == "null"));
Boolean.toString(request.getParameter("parameter") == null));
Boolean.toString(request.getParameter("parameter").isEmpty()));
Boolean.toString(request.getParameter("parameter").isBlank()));

this outputs

false
false
false
false

1 Answers1

0

Did you try Boolean.toString(request.getParameter("parameter").equals("null"));?

SteffenJacobs
  • 402
  • 2
  • 10