I was going through HFSJ 1st edition Q15.
Q:- Once a session has been invalidated, which HttpSession methods can be called on that session without throwing illegalState Exception?
Options -
A: invalidate
B: getAttribute
C: setAttribute
D: getServletContext
E: getAttributeNames
Answer: - Since the servletContext survives, getServletContext can be called successfully on an invalid session.
I am not so clear why? if an object is invalid now...how and why getServletContext servives. Trying to access this should give null pinter exception or
illegalStateException.
Please clarufy this doubt