Why servlet context is used but not ServletConfig

What is use of the servletconfig

Showing Answers 1 - 3 of 3 Answers

Vinod

  • Jul 27th, 2011
 

ServletContext is used to hold information about the application. One object serve whole application. while Servletconfig hold the information about the servlet only. each servlet has its own servletconfig object.

  Was this answer useful?  Yes

ServletContex is used to hold information required through out application. One object created for per application and remain active until server is up. while servlet config is used to hold information specific to servlet only. object created one per serlvet and remain active as long as servlet is live.

  Was this answer useful?  Yes

josesaid

  • Jul 27th, 2011
 

The ServletContext is the way to comminucate with the whole application, and the servletconfig is to communicate just with the actual servlet...
Greetings...

Code
  1. this.getServletContext().getContextParameter();....

  2. here you could get application

  3. parameters located in the web.xml block!

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions