In JSP, application is an implicit object of type ServletContext.
The instance of ServletContext is created only once by the web container when application or project is deployed on the server.
This object can be used to get initialization parameter from configuaration file (web.xml). It can also be used to get, set or remove attribute from the application scope.
This initialization parameter can be used by all jsp pages.
Example of application implicit object:
index.html
web.xml file
sonoojaiswal /welcome.jsp sonoojaiswal /welcome dname sun.jdbc.odbc.JdbcOdbcDriver
welcome.jsp
<% out.print("Welcome "+request.getParameter("uname")); String driver=application.getInitParameter("dname"); out.print("driver name is="+driver); %>
Output
Leave A Comment