Obviously in both cases only the .class file can be run.

What differs is when and how they get compiled.  Your servlet's source 
is not monitored ever but your JSP source is.  Therefore when the JSP 
source changes the container recompiles it and executes teh new .class 
file.  In the case of a servlet, changing source is not detected but (if 
configured) changed .class file is.  In order to have a new .class file 
you need to compile the .java file yourself.

Servlet .class file is no different from HelloWorld.class file.  It just 
requires some stuff on classpath in order to get compiled and it can't 
be run directly but is invoked by the servlet container.  You can write 
your own servlet container if you want too.  Make it an HTTP server. 
When a request for it is made (http://localhost/SillyServlet) have it 
load your servlet class by name (cast it to HttpServlet) and  execute 
its init() and then its doGet() method with the right parameters.

d.


Kenny G. Dubuisson, Jr. wrote:
> Hello all again.  I have 3 simple questions that I'd like to see if anyone
> knows (please let me know if this is off topic or not).
> 
> 1)  I'm working on teaching myself JSP/Servlets.  I wanted to know if when a
> servlet is run the ".class" or the ".java" file is what got run.  So I
> renamed one of Tomcat's example files ("HelloWorldExample.class") to a
> "*.bak".  Once my test was done I renamed it back to the original file name.
> Now it won't run.  Gives me a "Apache Tomcat/4.0.5 - HTTP Status 503 -
> Servlet org.apache.catalina.INVOKER.HelloWorldExample is currently
> unavailable" error.  I thought it maybe had something to do with the java
> and class files having the same time stamp so I copied both from the
> original Tomcat distribution and it still won't run.  Man I'm stuck on this
> one...any ideas?
> 
> 2) How do you get a ".class" file when you create a ".java" Servlet file?  I
> was hoping that if I delete a ".class" file and the ".java" file still
> exists, the ".class" file gets recreated/recompiled automatically by Tomcat.
> 
> 3) What the heck does Jakarta mean?  I'm voting that it's a small Italian
> cart used for transporting fish remains.
> 
> Thanks,
> Kenny
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
> 

-- 
David Mossakowski              [EMAIL PROTECTED]
Instinet Corporation                 212.310.7275



*******************************************************************************
<<Disclaimer>>

This message is intended only for the use of the Addressee and 
may contain information that is PRIVILEGED and/or
CONFIDENTIAL or both.

This email is intended only for the personal and confidential use
of the recipient(s) named above.

If the reader of this email is not an intended recipient, you have
received this email in error and any review, dissemination,
distribution or copying is strictly prohibited.

If you have received this email in error, please notify the sender
immediately by return mail and permanently deleting the copy
you received.

Thank you.

*******************************************************************************


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to