• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

regarding the listener interfaces

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

in answer to your questions

(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)

HTH Mat
 
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic