Difference between Servlet and JSP :
SERVLET
|
JSP
|
Handles Dynamic data
|
Handles Dynamic data
|
Handles business logic
|
Handles presentation logic
|
Lifecycle methods init() : can be overridden service() : can be overridden destroy() : can be overridden
|
Lifecycle methods jspInit() : can be overridden _JspService(): cannot be overridden jspDestroy() : can be overridden
|
Html within java out.println(“
<html><body>”); out.println(“Time is “+ new Date()); out.println(“</body></html>”);
|
Java within html
<html><body>
Time is <% new Date(); %></body></html>
|
Runs within a Web Container
|
Runs within a Web Container
|
JSP Processing:
Internally, JSP gets converted into a Servlet
• When the user requests for a .jsp file for the first time, the JSP Container will create a Servlet that would produce the output that the .jsp file is supposed to produce.
• Starting from the second request, there is no overhead of compilation.
Comments
Post a Comment