This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
JSPs are used like HTML markup using special JSP tags, but generating dynamic (versus static) content. Servlets extend the functionality of a server and are used to prepare javabeans for JSPs to use. Servlets are the controller and JSPs are the view. That's a very short explanation but the best way is to read books and/or on line articles on the subject and then practice with an app server which you can easily install in your PC.
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
The easy difference is that using JSP you insert calls the class into markup (html tag) but using Servlet you insert tag into class code. Using JSP you divide the presentation and bisness logic. Servers which allow JSP automatically create servlets from jsp pages.
Here's an answer a fellow programmer of mine had: Well JSP actually turns into a servlet the first time it is accessed. I discussed this recently with my colleagues and basically it seems cleaner to use JSP with tag libraries to generate XML than to do stuff with servlets. Anyway you slice it, it is still compiled Java anyway. But JSP allows you to mix and match content, images, style sheets in the same directory with the JSP so you can easily refer to it. And it seems easier for people to figure out where to go to debug when they can just see a URL that matches the path in their directory. Another small benefit is that when you change a JSP you don't have to cycle the service it automatically gets recompiled and loaded in, so this is nice. JSP tag libraries give you a nice way to build and reuse code modules as well. There are other niceties that JSP's give you but the above features are some of the more important things. There is not much difference between using JSP and servlets other than the above but these small things make it a little nicer than just servlets.
[This message has been edited by Kai Middleton (edited August 01, 2001).]