First point
Boolean hasProfile7 = Boolean.valueOf(request.getParameter("hasProfile7"))
You are doing
Boolean.valueOf(<A String>)
According to https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html#valueOf(java.lang.String)
public static Boolean valueOf(String s) "Returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignoring case, to the string "true"."
Second point
Boolean hasProfile7 = (request.getParameter("hasProfile7").equals("on")) ? true : false;
Here you are close to the rigth thing to do. Your problem is that request.getParameter("hasProfile7") returns null and so you have *null*.equals("on")and thats why you get the NPE.
When you have a predefined String, always put it on the left size:
Boolean hasProfile7 = ("on".equals(request.getParameter("hasProfile7"))) ? true : false;
Here, even if request.getParameter("hasProfile7") is null you have any exception and it will simply return false
Third point
Boolean hasProfile7 = (request.getParameter("hasProfile7") == "on") ? true : false;
Here you are comparing the object "on" to the object request.getParameter("hasProfile7"). If the values are the sames, the objects are not.
For the last point, why do you use a ternary expression (request.getParameter("hasProfile7").equals("on")) ? true : false;
can be translated to
if true --> true
if false --> false
You can just write
Boolean hasProfile7 = "on".equals(request.getParameter("hasProfile7"))
"on".equals(request...)to avoid the NPE.