File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP and servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and servlet" Watch "JSP and servlet" New topic

JSP and servlet

aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
What is the difference between JSp and servlet.
Is there any life cyle difference.
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
A JSP is basically the source code for a servlet. The server simply provides you with certain shortcuts. For example, without the special tags (scriptlets, taglibs, directives, etc), the content is simply assumed to be sent to the response. The difference is that the server will compile your JSP into a .class file for you at execution time (if it has been changed or has not been previously compiled). From then on, it is treated the same as a servlet.

"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The team, Newsletter 039.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

aakash, perform a search on this subject in this forum and the Servlets forum and you will find more information on this as it has been discussed many times before.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: JSP and servlet
jQuery in Action, 3rd edition