This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.....