Home > DeveloperSection > Interviews > What is difference between ServletConfig and ServletContext?

Posted on    November-03-2014 11:09 PM

 Java Session 
 1 Answer(s)
  726  View(s)
Rate this:

Kamlakar Singh
Kamlakar Singh

Total Post:80

Posted on    November-04-2014 12:09 AM

Some of the differences between ServletConfig and ServletContext are:

  • ServletConfig is a unique object per servlet whereas ServletContext is a unique object for complete application.
  • ServletConfig is used to provide init parameters to the servlet whereas ServletContext is used to provide application level init parameters that all other servlets can use.
  • We can’t set attributes in ServletConfig object whereas we can set attributes in ServletContext that other servlets can use in their implementation.

Don't want to miss updates? Please click the below button!

Follow MindStick