Issue
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
Solution
Did you try Boolean.toString(request.getParameter("parameter").equals("null"));
?
Answered By - SteffenJacobs
Answer Checked By - David Goodson (JavaFixing Volunteer)