4

Possible Duplicate:
What is the difference between JSF, Servlet and JSP?

What is the Exact difference between the Servlet And JSP

Community
  • 1
  • 1
Kaushik
  • 41
  • 1
  • 3

3 Answers3

6

A JSP is a special kind of Servlet that is edited in a HTML-like syntax and compiled into Servlet byte code by a web container (usually at deploy-time or when first accessed).

JSPs can contain complex Java code, however that has been considered a bad practice for the last 8 years or so, so JSPs will usually only contain

(Judging by the age of the above links you can tell that JSP is not exactly cutting-edge anymore)

Sean Patrick Floyd
  • 284,665
  • 62
  • 456
  • 576
2

JSP is a template language that the servlet/JSP engine compiles into a servlet, which is then compiled into Java byte code and executed.

Think of JSP as a convenient HTML factory.

duffymo
  • 299,921
  • 44
  • 364
  • 552
1

Simply, Servlet is Java code that outputs HTML. JSP is the opposite, it's HTML that has Java code inside tags.

M.Sameer
  • 3,002
  • 1
  • 26
  • 37