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
  • 292,901
  • 67
  • 465
  • 588
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
  • 305,152
  • 44
  • 369
  • 561
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,072
  • 1
  • 24
  • 37