91-9990449935 0120-4256464 |
4) JSP config implicit objectIn 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<form action="welcome"> <input type="text" name="uname"> <input type="submit" value="go"><br/> </form> <web-app> <servlet> <servlet-name>sonoojaiswal</servlet-name> <jsp-file>/welcome.jsp</jsp-file> <init-param> <param-name>dname</param-name> <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>sonoojaiswal</servlet-name> <url-pattern>/welcome</url-pattern> </servlet-mapping> </web-app> <% out.print("Welcome "+request.getParameter("uname")); String driver=config.getInitParameter("dname"); out.print("driver name is="+driver); %> OutputOther topics in JSP implicit ObjectsExample of request implicit object Example of Response implicit Object Example of application implicit object Example of session implicit object Example of pageContext implicit object Example of page implicit object Example of exception implicit object |