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

Small doubt ...

 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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 ...
 
Stary Kapec
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
http://tomcat.apache.org/tomcat-4.1-doc/jasper/docs/api/org/apache/jasper/runtime/HttpJspBase.html

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:
http://www.docjar.com/html/api/org/apache/jasper/runtime/HttpJspBase.java.html

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 }
99
[ May 12, 2007: Message edited by: Jasiek Motyka ]
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic