I really to init a sessionScope variable when an app runs. Which is the right way to do this ?
// Edit: Firstly, I want to sorry for my not understandable question. All what I want is : An listener or something like that which can listen when the app runs first time and create session and put an attribute to it.
Thanks
Implement a
HttpSessionListener.That’s it. If you’re still not on Servlet 3.0 (Tomcat 7, Glassfish 3, etc) yet, then you need to register it as
<listener>inweb.xmlinstead of using@WebListenerannotation.