Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet" Watch "Servlet" New topic
Author

Servlet

Abhijeet Neware
Greenhorn

Joined: Mar 28, 2011
Posts: 16
This question is confused me every time so guide me someone please.....
Difference between ServletConfig and ServletContext
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

There is only one servletContext per application but there is one ServletConfig per servlet. Hence we write servletContext in application tag of xml file and write servletConfig in servlet tag of xml file.

There are many servletConfig in application but only one ServletContext in an application.

If you want to use a variable through out the application then you have to use servletContext and if you want to use varible only for partivular servlet then use servletConfig.


Life is easy because we write the source code.....
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Please UseAMeaningfulSubjectLine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet
 
Similar Threads
A Challenge!
Google India CodeJam
acronym atrocity
13 Nov Riddle
How many Brits and Europeans on this board?