What is the difference between Java Servlets and Java ServerPages (JSP)?

A JSP is a Servlet with a Web page flavor.There are more similarities than differences between the two.JSP uses its own tags which are ultimately using tag libraries implemented in Java.
The source code of a servlet  with HTML embedded in out. print (...) statements, gives dynamic features to webpages but that makes a cumbersome process to maintain servelts from web design perspective.If someone has implemented GUI related code inside servlet then each time a small GUI change will result in recompilation of the whole code.Hence business logic centric development should be done inside servlet and JSP gives a choice of combining both in much targeted way.JSP was devised to differentiate the tasks of web designers,responsible for look and feel of the webpages, from web developers who deal in business logic development.So both entities have focused interest met through JSP.In fact, a JSP gets compiled into a servlet.


Anonymous said...

All JSP page will convert into Servlet. So when you call jsp page at that time that jsp page will convert into equivalent servlet and that servlet will execute on server.

JSP provides easy user interface than servlet.

For more about JSP and Servlet refer this Site

exmainationtime on November 20, 2012 at 6:33 AM said...

Servlet is for java developers and JSP is for Web developers oriented.
Servlet uses java only while JSP uses java and html


Interview Questions On Java,Java EE Copyright © 2018. Reads: best tracker