Servlet and JSP

Difference between Servlet and JSP ?

Last updated:7/18/2018 5:31:08 AM

1 Answers

Prakash nidhi Verma
Prakash nidhi Verma

Servlet :

servlet is a Java class which is used to extend the capabilities of servers that host by webs servers and applications accessed by means of a request-response model.they can respond to other types of requests too. HTTP-specific servlet classes are defined by Java Servlet technology. 

- Servlet is a java code 

- Writing code for servlet is

- harder than JSP as it is html in java

- Servlet plays a controller role in MVC approach

- Servlet is faster than JSP

- Servlet can accept all protocol requests.

- In Servlet, we can override the service() method

JSP : 

A JSP is a text document which contains two types of text 

- static data : HTML,XML,SVG and WML

- dynamic datain : JSP elements

- JSP is a html based code 

- JSP is easy to code as it is java in html

- JSP is the view in MVC approach for showing output

- JSP only accept http requests

- In JSP we cannot override its service() method

- In JSP session management is automatically enabled

- just need to click the refresh button its fast