hi guys, i have some doubts from the chapter on attributes adn listeners.the page number is 182 where the eight listeners have been mentioned along with their functions.following are my queries :-
(a)what is the differnce between a request attribute and a [/B]session attribute[/B]
(b)for the ServletContextListener interface the scenario mentioned is that it is used to know if a context has been created or destroyed.how can one create/destroy context(i'm not able to get the meaning of context)?
that's it for now.hope you will help me out of this.
thanks in anticipation
when the going gets easy,you are going downhill.......<br /> <br />abhishek tiwari<br />scjp 93%<br />scwcd in progress
(a)what is the differnce between a request attribute and a session attribute
a Request attribute is part of a request (HttpServletRequest). That is it is set and obtained via the methods HttpServletRequest.getAttribute and HttpServletRequest.setAttribute. A session attribute is part of the session (HttpSession). A session attribute is set and obtained via the methods HttpSession.getAttribute() and HttpSession.setAttribute(). Note that the same attribute can be store on both the Request and Session.
b)for the ServletContextListener interface the scenario mentioned is that it is used to know if a context has been created or destroyed. how can one create/destroy context(i'm not able to get the meaning of context)?
The meaning of Context in this case is web application. So with Tomcat for example contextInitialized will be called when the web application is loaded and the web.xml file is parsed, and contextDestroyed will be called as the web application is shut down. This is usually when you start and stop Tomcat, but if you use the Tomcat Manager then you can start, stop, and redeploy a web applications on an application by application basis and these would also call those methods (contextInitialized and contextDestroyed)