Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling sub class' method from super class

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This line is with reference to page 294 of HFS&J.

"Builds the service() method. This service method's actual name is _jspService(). It's called by the servlet superclass' overridden service() method....."

So in case of tomcat, the super class of this servlet (which was JSP before) is HttpJspBase. This HttpJspBase is also servlet (extends HttpServlet) and has overriding service() method. Now this overriding service() method calls our _jspService() method...

I am confused, how can we call sub class' method from super class without even knowing the name of sub class???

Hope my question is clear.
Thanks.

[ May 16, 2006: Message edited by: rathi ji ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because HttpJspBase defines the _jspService method as abstract.

for example:


The container is going to instanciate your jsp with something like:
HttpJspBase servlet = new MyJspFile();

I hope this is clear enough.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It says:
from the superclass' overridden service() method
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben and Satou.
I got the point Ben.

[ May 16, 2006: Message edited by: rathi ji ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic