File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Confused about inheritance of HttpJspPage Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Confused about inheritance of HttpJspPage" Watch "Confused about inheritance of HttpJspPage" New topic
Author

Confused about inheritance of HttpJspPage

John Strong
Greenhorn

Joined: Jul 23, 2006
Posts: 13
Supposedly, when the Container receives a JSP, it generates an HttpServlet object, but when I look at the example code on p. 295 of HFSJ, the generated class extends HttpJspPage, not HttpServlet.

Now, this confuses me, for several reasons:
(1.) HttpJspPage is not an extension of HttpServlet, it is an interface, according to
http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/javax/servlet/jsp/HttpJspPage.html. Why would the generated class be *extending* (rather than implementing) an interface?

(2.) If the generated servlet really did extend HttpServlet, it would not inherit the HttpJspPage interface, because HttpServlet inherits the implementation of the Servlet interface from GenericServlet, but it does not inherit HttpJspPage.

Who inherits what here? Who gets the house, who gets the car, who gets the kids???

Thanks, - John Strong (pluviosilla@gmail.com)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24041
    
  13

I don't have HFSJ, so I can't explain exactly what the book page is saying, but the requirement is just that the generated class implement HttpJspPage. The container is not required to do so by extending HttpServlet, although it certainly could if it wanted to.


[Jess in Action][AskingGoodQuestions]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

Moved to the JSP forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

the generated class extends HttpJspPage,


The book does not say that. It extends HttpJspBase which is an internal Tomcat class.

org.apache.jasper.runtime.HttpJspBase extends HttpServlet and implements javax.servlet.jsp.HttpJspPage.

See http://tomcat.apache.org/tomcat-4.1-doc/jasper/docs/api/org/apache/jasper/runtime/HttpJspBase.html
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Confused about inheritance of HttpJspPage
 
Similar Threads
What is need of JspPage, HttpJspPage interfaces in JSP
Request Dispatcher
Variable session timout
PageContext and JspContext
maintaining session