<JSP config implicit objesct with example
SQL Oracle Java JSP JDBC MORE

JSP Config implicit object


In JSP, config is an implicit object of type ServletConfig. Config Implicit object is used for getting configuration information for a particular JSP page like get the driver name, servlet name etc.

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.

web.xml

<web-app>
<servlet>
<servlet-name>StudentsTutorial</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>StudentsTutorial</servlet-name>
<url-pattern>/index</url-pattern>
</servlet-mapping>
</web-app>

index.jsp

<!DOCTYPE html>
<html>
<head>
<title> JSP Config</title>
</head>
<body>
<%
String name=config.getServletName();
out.print("Name of Servlet is: "+name);
%>
</body>
</html>