tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sriram N <sriramx_2...@yahoo.com>
Subject RE: how's the jsp page compile into servlet
Date Tue, 02 Sep 2003 04:43:27 GMT
Manish:

Tomcat is actually made up of a number of different units of funtionality. 
The "Tomcat" that you see is actually made up of
Catalina - provides the servlet services
Jasper - the JSP Page compiler
Conectors - provides HTTP services and integration with web servers such as
IIS, Apache, etc.
Valves - For other internal features and for implementing the Servlet API.

If you check the default web.xml, you will find a servlet that handles requests
for JSP pages.

When you ask for a JSP Page
a. The JSP servlet receives this request.
b. It checks for a class corresponding to the JSP page.
c. If such a class does not exists, the JSP page is converted in to Java
source. (I think the JSP if first converted into XML, I'm not sure about
this...)
If the class exists, and it is older than the JSP Page, the JSP page is
converted to Java source again.
d. This Java source is then compiled to generate a .class file. you will find
both the java source and the .class file in the work directory within tomcat.
e. A Classloader for this specific JSP Class is created; It loads the JSP class
and serves the request.

I do not recall what exactly happens in case the JSP class is already present.

I strongly urge you to download the tomcat source and explore it - you will
learn a lot. I know that it has changed my life and how I look at Open source.

-- Sriram
Business Development.
Object Edge Software India Pvt. Ltd.

--- Schalk <schalk@volume4.co.za> wrote:
> Manish
> 
> As far as I know, and anyone please correct me on this if I am wrong, this
> is handled by the internal compiler within Tomcat and the .class is placed
> within web application scope.
> 
> You can register a .jsp to act as a servlet and call it as if it is one. For
> instance on our website we include our footer.jsp like this.
> 
> First add the following code to your web.xml:
> <servlet>
>     <servlet-name>footer</servlet-name>
>     <description>Copyright footer for www.volume4.co.za</description>
>     <jsp-file>/includes/footer.jsp</jsp-file>
>  </servlet>
> 
> You can now call it from anywhere within your webapps simply as
> /servlet/footer, for instance <jsp:include page="/servlet/footer"
> flush="true"/>
> 
> Hope this helps.
> 
> Kind Regards
> Schalk Neethling
> Volume4.Development.Multimedia.Branding
> emotionalize.conceptualize.visualize.realize
> Tel: +27125468436
> Fax: +27125468436
> email:schalk@volume4.co.za
> web: www.volume4.co.za
>  
> 
> :: -----Original Message-----
> :: From: manish pandey [mailto:manish_pandey2k@yahoo.com]
> :: Sent: Monday, September 01, 2003 9:28 AM
> :: To: tomcat-dev@jakarta.apache.org
> :: Subject: how's the jsp page compile into servlet
> :: 
> :: hello sir ,
> ::   i am new in ur list. i would like to answer that
> :: how's a jsp page covert into a servlet and where is
> :: the .class file store in webapplication . and how a
> :: web.xml find these servlet name and servlet class name
> :: .plese
> ::  tell me the internal details about application server
> :: 
> ::                                         wating ur
> :: reply
> ::                                         manish
> :: 
> :: 
> :: __________________________________
> :: Do you Yahoo!?
> :: Yahoo! SiteBuilder - Free, easy-to-use web site design software
> :: http://sitebuilder.yahoo.com
> :: 
> :: ---------------------------------------------------------------------
> :: To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> :: For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Mime
View raw message