The page variable is an alias for this, which refers to the servlet instance. It wasn’t really very useful when scriptlets were in vogue, and is now completely useless in scriptless pages.
The page implicit object is of type Object and it is assigned a reference to the servlet that executing the _jspService() method. Page is the instance of the JSP page’s servlet processing the current request. Not typically used by JSP page authors. Thus in the Servlet generated by tomcat the page object is created as
Object page = this;
Since page is a variable of type Object, it cannot be used to directly call the servlet methods. To access any of the methods of the servlet through page it must be first cast to type Servlet.
<%= this.getServletInfo(); %> <%= ((Servlet)page).getServletInfo(); %>
But the following code will generate error, because can not use page directly without casting:
<%= page.getServletInfo(); %>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…