SQL Oracle Java JSP JDBC MORE

JSP Application implicit object


In JSP, Application implicit object used for getting initialization parameters and for sharing the attributes and their values across all JSP page.That means any attribute set by application implicit object would be available to all the JSP pages.

Application implicit object is an instance of javax.servlet.ServletContext.

Application implicit object Example

index.jsp

<%@ page import="java.io.*,java.util.*" %> <!DOCTYPE html>
<html>
<head>
<title> Application Implicit Object</title>
</head>
<body>
<h1>JSP Tutorial</h1> <%
Integer counter= (Integer)application.getAttribute("visit");
if( counter ==null || counter == 0 ){
counter = 1;
}
else{
counter = counter+ 1;
}
application.setAttribute("visit", counter);
%>
<h3>Total number of view to this Page is: <%= counter%></h3>
<p>Copyright © 2017 By <a href="//www.studentstutorial.com" target="_blank" style="text-decoration:none"><b style="color:green">studentstutorial.com</b></a>. All Rights Reserved.</p>
</body>
</html>

Output