File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes JSP and Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
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.
I agree. Here's the link:
subject: JSP and Servlets
It's not a secret anymore!