Typically a JSP is parsed and converted to an instance of HttpJspPage. HttpJspPage extends JspPage, which extends Servlet. However, it is possible to force a JSP to extend a specific class using the page directive as follows:
<%@ page extends="com.apackage.AServlet" %>
In this example the JSP will end up extending com.apackage.AServlet. Forcing a JSP to extend a class other than the default class provided by the JSP vendor should be done wisely and sparingly, since the default superclass provided by the JSP vendor may contain optimizations and other needed custom behaviors.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.