Servlet Context Param

Servlet Context Param is used to define global or application scope parameter for the application which can be shared by all the available servlets inside the jsp/servlet container. these parameters can be used to customize the behavior of web application. context parameters are stored an object of ServletContext, which is created at the time of deploying the web appplication on server.

 Example of context-param for web application :-

Here we have define the context param to create connection for database. Refer below example...
context-param


 Servlet code to read context-param define inside the web.xml. :-

servlet-read-context-param

 Real Example of context-param from spring mvc popular web framework:-

context-param-real-example.png