top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is the Difference between Servlets Context and Servlet Config?

+1 vote
139 views
What is the Difference between Servlets Context and Servlet Config?
posted May 11, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Servlet Config

Servlet config object represent single servlet.

Its like local parameter associated with particular servlet.

It’s a name value pair defined inside the servlet section of web.xml file so it has servlet wide scope.

getServletConfig() method is used to get the config object.

for example shopping cart of a user is a specific to particular user so here we can use servlet config.

Servlet Context

It represent whole web application running on particular JVM and common for all the servlet.

Its like global parameter associated with whole application.

ServletContext has application wide scope so define outside of servlet tag in web.xml file.

getServletContext() method is used to get the context object.

To get the MIME type of a file or application session related information is stored using servlet context object.

answer May 11, 2016 by Karthick.c
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...