Technically there is no way to get the web session from a normal java class (POJO).
However if you wire your POJO into a web application using the J2EE MVC
pattern or FrontController pattern.i.e JSP submits to servlet, servlet passes the HttpServletRequest Object to POJO or bean. You can access your web session, your servlet context throught the request obejct.
I suggest you do some research on MVC and FrontController design patterns.
Does any one has an easy sample code to manage the session? I have done this only in php and I want to do the same with Java Server Pages.
I want to know how to create the session, how to destroy the current session and clear all variables, how to get the session id and how to read the session variables.