HI,
Came across this example in one of the mock tests ...
The option given were
1.) Throws NullpointerException
2.) Prints Hello;
3.)None of the above
The Answer is 2.) Prints Hello;
The example said that the page is being accessed for the first time ..
my thought was that
request.getSession(false) would be retunning null as the session is not yet created .... is it that since the
session attribute of the page directive being default true causes this behaviour.
any explanation to this behaviour ? is it different in
JSP and
servlet ??
In servlet code i believe
request.getSession(false) would have thrown an NullPointerException for the session would not have been created for the first time untill the response is committed.
Thanks,
Reshma