In JSP, config is an implicit object of type ServletConfig. This object can be used to get initialization parameter for a particular JSP page. The config object is created by the web container for each jsp page.

Generally, it is used to get initialization parameter from the web.xml file.

Example of config implicit object:

index.html


web.xml file

  
  
  
sonoojaiswal  
/welcome.jsp  
  
  
dname  
sun.jdbc.odbc.JdbcOdbcDriver  
  
  
  
  
  
sonoojaiswal  
/welcome  
  
  
  

welcome.jsp

<%   
out.print("Welcome "+request.getParameter("uname"));  
  
String driver=config.getInitParameter("dname");  
out.print("driver name is="+driver);  
%>  

Output

jsp config implicit object output 1 jsp config implicit object output 2