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

Difference between JSP and Servlets

vibhor mathur

Joined: Jun 06, 2009
Posts: 11
hello everybody
What is the difference between servlets and JSP?
David Newton

Joined: Sep 29, 2008
Posts: 12617

Have you searched the web for the answers to this?

In a nutshell, servlets are written in Java. JSPs are plain-text files that get converted into equivalent servlets.
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Here is a link that might help


A related article


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Vamsi Mohan
Ranch Hand

Joined: Jun 20, 2009
Posts: 80
[copied material removed -- do not copy material from other sites without references]

(SCJP5.0, IBM Rational Solution Designer, IBM Rational Architect, IBM RUP Designer)
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Vamsi Mohan wrote:A Java Server Page is a completely web based content. JSP pages contain a mixture of HTML, Java scripts (not to be confused with JavaScript) ...

Although the use of Java scriptlets in JSP pages is considered a poor practice at this juncture, replaced by the JSTL and EL.

And, a JSP can certainly contain JavaScript. Think of a JSP as a template for an HTML page.

[Asking smart questions] [About Bear] [Books by Bear]
David Newton

Joined: Sep 29, 2008
Posts: 12617

@Vamsi: when quoting other sources it's nice to provide a reference.
Prashant Langade
Ranch Hand

Joined: Jul 01, 2009
Posts: 73
Servlet's are java programs which gets executed on server and JSP's are used for showing server response to end user.Thus in short Servlet's are used for request processing while JSP's are used for presentation logic.

Hope this helps you!!!

I agree. Here's the link:
subject: Difference between JSP and Servlets
It's not a secret anymore!