Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Small doubt ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Small doubt ..." Watch "Small doubt ..." New topic

Small doubt ...

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585

A JSP is converted into a Servlet that's cool, and it's said that, that Servlet's service() method nivokes the generated servlet's _jspService method right ?

I have seen a generated Servlet ok ? but where's the other Servlet that's calling the _jspServive of the generated one ?

I'm just not getting how

Please clear my doubts ...

Thanks in advance ...

Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Stary Kapec
Ranch Hand

Joined: Dec 04, 2005
Posts: 81
Here is a snippet of the generated servlet by tomcat:

public final class SimplePage_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {

As you can see the generated servlet extends a class org.apache.jasper.runtime.HttpJspBase.

It is a tomcat specific class that we should not care about as long as it implements javax.servlet.jsp.HttpJspPage and it is the class that is overriding void servlet(HttpServletRequest, HttpServletResponse) method so it invokes _jspService()

Here is link to the class implementation:

See how the service method is implemented it is very trivial:

94 public final void service(HttpServletRequest request, HttpServletResponse response)
95 throws ServletException, IOException
96 {
97 _jspService(request, response);
98 }
[ May 12, 2007: Message edited by: Jasiek Motyka ]
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Mr. Jasiek, you have cleared my doubts, thank you so much, i now got it, so it's the same generated class that's doing all the work, implementing the service() method and invoking the _jspService()

So cool

Thank you again ...

Have a nice day ...
I agree. Here's the link:
subject: Small doubt ...
It's not a secret anymore!