Consider the following
JSP code
What will it print for the very first request to this page as well as the web application that contains this page?
<html><body>
<%
Integer count = (Integer) request.getSession(false).getAttribute("count");
if(count != null )
{
out.println(count);
}
else request.getSession(false).setAttribute("count", new Integer(1));
%>
Hello!
</body></html>
Given answer: It will print Hello and will set the count attribute in the session.
According to me, since the parameter to request.getSession() is false in both the if and else clause(s), a session will not be created at all.
Shouldn't it throw a NullPointerException?