JSP and Servlet

W

Wibble

JSP's are servlets that are code generated from
a template. The template looks like some
extra tags in an HTML document, more or less.
 
R

Ross Bamford

Anyone can tell me what is the difference between JSP and Servlet? Thanks a lot!

JSP's are a terrible abomination, a blight in the technical history of
the human race, and the cause of more frustration, anger, breakdown and
suicide than any other software product since Visual J++.

Servlet is an interface in javax.servlet.

;)
 
A

Alvin Ryder

az said:
Anyone can tell me what is the difference between JSP and Servlet?
Thanks a lot!

Servlets are written in pure Java. Requests for a web page go to a Java
program.

JSP's are HTML pages with some Java hacked into them. They are neither
pure HTML nor pure Java. It is a more limited and hybrid environment.

The big question is do you have Java outputing HTML or do you have HTML
trying to hook into code?

JSP's appear to provide some syntactic sugar as a solution, which
sounds nice but the limitations catch up very quickly.

Besides that to know how JSP's work you need to understand the Servlet
API anyway. Application scope, session scope, cookies, ... so it is not
a case of "one or the other".

Servlets can emit HTML and if you're wise you can do it in a tidy
fashion.

Most books and simple examples just do a crude out.print(...HTML
gut...) then go running to JSP for help but only to run from the frying
pan into the fire.

With Servlets you have the full power of a decent OO language at your
disposal, it is possible to do HTML simply and neatly with perhaps a
light dose of JSP.

The other path has led to progressive chaos!

First JSP
Then JSP + Taglibs
Then JSP + Taglibs + JSTL
Then JSP + Taglibs + JSTL + "EL" (Expression Language)
Then JSP + Taglibs + JSTL + "EL" + JSF (JavaServer Faces)

All because some people can't work out how to use OOP to output HTML
from Servlets in a reasonable OOP way.

JSF is to web pages what Swing is to GUI's so it's promising but that
is another topic.

HTH,
Cheers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top