The best place to get answers to this sort of question is the API JavaDocs.
The short answer is no, you can't get the session from the ServletContext. It doesn't make much sense to try either. The ServletContext is an object that encapsulates the environemnt the servlet is deployed in.
Actually i read on this topic in "The Head First Servlet & JSP", which really confused me and a big question was biting me," is that the only way to get session? Can't we get it from ServletContext?" thats all...And i could not find any proper answer. There is a line written in the book,-But there is another way that can get a session...from a session event object.I am unable to follow this topic in the book, so i needed help to clearify my confusion. Was my question stupid?then i am really sorry...but i need to be cleared.
Probably reading the book a little more deeper would give you some idea. As far as I have gone through, they have mentioned about getting the session from the Servlet Context. If possible go through the complete book. Happy reading!
When you get to the section that covers event listeners the concept of event objects should become more clear.
There was, in the past, an object called SessionContext that held references to all of the sessions. It allowed you to fetch one by ID. For security reasons, it's been deprecated. These days, with listeners, it's easy to duplicate this functionality yourself if you need it.
As Bear mentioned, your question was not stupid. Sometimes knowing why someone is asking a question can lead to a better answer than the question itself.
If something doesn't make sense, don't ever be afraid to ask here. -Ben