JSP page implicit object

JSP page object is an instance of java.lang.Object. As we discussed earlier that JSP is translated into servlet by web container. JSP page object refers the instance of this servlet. It is act as a synonym for this object.

As it represents the servlet, it must be cast to HttpServlet.

this can also be used directly on JSP page instead of page object.

Example:

welcome.jsp

<html>
	<head>
		<title>page implicit object example</title>
	</head>
	<body> 
		<%	
		  out.print("This is a page implicit object example.");
		  out.print("Name of the auto generated servlet: " 
                                              + this.getServletName()); 
		%>
	</body>
</html>

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>welcome.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 25
 
Download this example.
 
Next Topic: JSP exception implicit object with example.
Previous Topic: JSP pageContext implicit object with example.

Related Topics:

JSP implicit objects with example.
JSP out implicit object with example.
JSP request implicit Object with example.
JSP response implicit object with example.
JSP config implicit object with example.
JSP application implicit object with example.
JSP session implicit object with example.
JSP pageContext implicit object with example.
JSP page implicit object with example.
JSP exception implicit object with example.