JSP application

JSP application object is an instance of servlet's ServletContext interface. It is used initialize parameter of one or more JSP pages in an application. Thus, the scope of application object is wider than config object.

Example of JSP Application

This example shows the functionality of various methods of application object.

index.jsp

<html>
<head>
<title>Tutorial and Example</title>
</head>
<body>
<%
String tut="JSP Tutorial";
application.setAttribute("var",tut);
String fetch=(String)application.getAttribute("var");
String info=application.getServerInfo();
int majversion=application.getMajorVersion();
int minversion=application.getMinorVersion();
%>
<h2 align="center">
<%=fetch %>
<br>
<%="Servlet Info:"+info %>
<br>
<%="Major Version:"+majversion %>
<br>
<%="Minor Version:"+minversion %>
</h2>
</body>
</html>
Output: