This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding the listener interfaces

 
abhishek tiwari
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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 session attribute

(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
 
Karthik Rajendiran
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
A servlet context exist for a web application per JVM in a distributed environment.

Lets not go to that. In a non-distributed environment, we have Servlet context created by container. if you want to do some operations at the time of servlet context creation,i.e even before the web resource is served to client [client request], like initialising datasource or reading some properties file, you implement the servletContextListener.

Where Session and request can be triggered with respect to client request.

When Request is sent , if the request listener is implemented , the corresponding method is called.

Similarly when the session is created , the sessionCreated method is called.
I think it is more self explanatory.

Can you post your doubt in more detail way?
 
abhishek tiwari
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi karthik,
first of all thanks for the reply.even i felt that the question was not framed in a proper manner but still you did a good job.

can i have your email id for further correspondence.

my email id is meetabhishek_t@yahoo.co.in

thanks once again for your instant response[ ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic