This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.....