This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP and Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and Servlets" Watch "JSP and Servlets" New topic

JSP and Servlets

Deep Nain Kundra

Joined: Jun 08, 2004
Posts: 2
What are the difference between JSP and Servlets?
james edwin
Ranch Hand

Joined: Nov 22, 2001
Posts: 393
It's like almost everything which you can do in servlet ,you can do in JSP too.But one difference i know between JSP and Servlet is :-

Servlet can be written for HTTP(HTTPSERVLET) and other protocols(GENERIC SERVLET) where as we can write JSP only for HTTP protocol.

If anyone else can add any point in this !!!



satish sathineni
Ranch Hand

Joined: May 03, 2004
Posts: 46
Servlets are used to develop dynamic webcontent ie WebApplications

Servlets are normal java classes Who generally have to extend
javax.servlet.http.HttpServlet class.

These are precompiled classes. (This is nothing but a Servlet Template)
Instead in a JSP java code is embedded in HTML for easier Page generation
as HTML code generation in Servlets could be very tedious if the HTML
data is large.
At Runtime the JSP/Servlet container converts the JSP into a Servlet and
executes it.

Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Not sure why this got posted in the 'Distributed Java' forum...

Moving to the JSP forum...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Deep Nain Kundra,

This is a very frequently asked question. See this thread from a couple of days ago.
I agree. Here's the link:
subject: JSP and Servlets
jQuery in Action, 3rd edition