This tutorial post highlights the important difference between JSP and Servlet technologies. This is one of the fundamental concept that confuses the many beginner Java web developers. The basic difference is that, JSP is for web page and Servlet is for Java components. Servlet is HTML in Java where as JSP is Java in HTML.
- Java EE Complete Reference
- A JSP technically gets converted to a servlet but it looks more like PHP files where you embed the java into HTML.
In this article we will list some of the differences between Servlet and JSP.
|A servlet is a server-side program||JSP is an interface on top of Servlets|
|Executes inside a Web server, such as Tomcat||A JSP program is compiled into a Java servlet before execution|
|Receives HTTP requests from users and provides HTTP responses||Easier to write than servlets as it is similar to HTML.|
|Written in Java, with a few additional APIs specific to this kind of processing||Can make use of Javabeans also|
|In MVC architecture Servlet acts as controller.||In MVC architecture JSP acts as view.|
|Servlet advantages include:|
Java Technology-network access,Database connectivity, j2ee integration
|JSP Provides an extensive infrastructure for:|