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.....