Understanding ServletConfig and ServletContext
In our servlet application development, some of the programmers will write fixed coding [ standard lines ], with in the servlet, which is not recommended. For example, if we write database related code in our servlet, in future if we would like to change any DB credentials in our servlet, we have to open > update > save > compile > re-deploy. By any chance, what if we need to modify 50+ servlet classes ? its really tedious.
In order to gain the performance of the web application by eliminating the duplicate source code, it is highly recommended to use the fixed technical database details in the web.xml file, web.xml provides external fixed technical details to the servlet.
So in order to develop flexible servlets we make use of web.xml and ServletConfig and ServletContext, let us see one by one in detail.
You Might Also Like
♦ About Author ♦