SlideShare a Scribd company logo
2
Most read
Difference between Servlet and JSP
Brief Introduction:
A servlet is a Java class which is used to extend the capabilities of servers that host
applications accessed by means of a request-response model. Servlets are mainly used to
extend the applications hosted by webs servers, however, they can respond to other types of
requests too. For such applications, HTTP-specific servlet classes are defined by Java Servlet
technology.
A JSP is a text document which contains two types of text: static data and dynamic data. The
static data can be expressed in any text-based format (like HTML, XML, SVG and WML), and
the dynamic content can be expressed by JSP elements.
Difference between Servlet and JSP
SERVLET JSP
Servlet is a java code. JSP is a html based code.
Writing code for servlet is harder than JSP as
it is html in java. JSP is easy to code as it is java in html.
Servlet plays a controller role in MVC
approach.
JSP is the view in MVC approach for
showing output.
Servlet is faster than JSP.
JSP is slower than Servlet because the first
step in JSP lifecycle is the translation of JSP
to java code and then compile.
Servlet can accept all protocol requests. JSP only accept http requests.
In Servlet, we can override the service()
method.
In JSP,we cannot override its service()
method.
In Servlet by default session management is
not enabled, user have to enable it explicitly.
In JSP session management is automatically
enabled.
In Servlet we have to implement everything
like business logic and presentation logic in
just one servlet file.
In JSP business logic is separated from
presentation logic by using javaBeans.
Modification in Servlet is a time consuming
task because it includes reloading,
recompiling and restarting the server.
JSP modification is fast,just need to click the
refresh button.

More Related Content

PPTX
0/1 DYNAMIC PROGRAMMING KNAPSACK PROBLEM
PDF
Operating Systems - Concurrency
PPTX
Open Source Ajax Solution @OSDC.tw 2009
PPTX
JAVA AWT
PPT
Java Database Connectivity
PDF
Multi-tier Designs in Software
PDF
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...
PDF
Database design & Normalization (1NF, 2NF, 3NF)
0/1 DYNAMIC PROGRAMMING KNAPSACK PROBLEM
Operating Systems - Concurrency
Open Source Ajax Solution @OSDC.tw 2009
JAVA AWT
Java Database Connectivity
Multi-tier Designs in Software
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...
Database design & Normalization (1NF, 2NF, 3NF)

What's hot (20)

PPTX
Shadow paging
PPT
Object and class relationships
PPTX
Distributed DBMS - Unit 1 - Introduction
PPTX
Java applet
PPSX
Functional dependency
PPTX
Graph in data structure
PPT
Lecture5
PPTX
Issues in knowledge representation
PPT
cloud computing:Types of virtualization
PPTX
Divide and conquer - Quick sort
PPTX
Dynamic Programming-Knapsack Problem
DOCX
Database development life cycle
PPTX
Introduction to HDFS
PPTX
Mongo Nosql CRUD Operations
PPTX
Mobile databases
PPT
Top down design
PPTX
Socket programming in Java (PPTX)
PPTX
Lock based protocols
PDF
Gof design pattern
Shadow paging
Object and class relationships
Distributed DBMS - Unit 1 - Introduction
Java applet
Functional dependency
Graph in data structure
Lecture5
Issues in knowledge representation
cloud computing:Types of virtualization
Divide and conquer - Quick sort
Dynamic Programming-Knapsack Problem
Database development life cycle
Introduction to HDFS
Mongo Nosql CRUD Operations
Mobile databases
Top down design
Socket programming in Java (PPTX)
Lock based protocols
Gof design pattern
Ad

Similar to Difference between Servlet and JSP.docx (20)

PPTX
JSP overview
PDF
Java EE 01-Servlets and Containers
DOCX
Java server pages
PPTX
Comapring jsp and Sevlet
DOC
Servlets and jsp pages best practices
PDF
Enterprise java unit-3_chapter-1-jsp
PDF
Introduction to JSP
PPTX
JAVA SERVER PAGE
PPTX
Jsp and Servlets
PPTX
Jsp Introduction Tutorial
PPT
JEE Course - The Web Tier
PPTX
JSP APP DEVLOPMENT.pptx Related to Android App Development
PPTX
Module 3.pptx.............................
DOCX
Online grocery store
DOCX
Bt0083, server side programming theory
DOCX
Bt0083, server side programming theory
DOCX
Unit 4 1 web technology uptu
DOCX
Unit 4 web technology uptu
PPTX
Jsp session 1
JSP overview
Java EE 01-Servlets and Containers
Java server pages
Comapring jsp and Sevlet
Servlets and jsp pages best practices
Enterprise java unit-3_chapter-1-jsp
Introduction to JSP
JAVA SERVER PAGE
Jsp and Servlets
Jsp Introduction Tutorial
JEE Course - The Web Tier
JSP APP DEVLOPMENT.pptx Related to Android App Development
Module 3.pptx.............................
Online grocery store
Bt0083, server side programming theory
Bt0083, server side programming theory
Unit 4 1 web technology uptu
Unit 4 web technology uptu
Jsp session 1
Ad

More from Dr. Somnath Sinha (9)

DOCX
Introducing CSS Selectors.docx
DOCX
Data structure design in SE
PPTX
Panel view
DOCX
PPTX
PPTX
PDF
black hole attack
PPTX
Introducing CSS Selectors.docx
Data structure design in SE
Panel view
black hole attack

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Big Data Technologies - Introduction.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation theory and applications.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Group 1 Presentation -Planning and Decision Making .pptx
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
A comparative analysis of optical character recognition models for extracting...
Big Data Technologies - Introduction.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology
Encapsulation theory and applications.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Network Security Unit 5.pdf for BCA BBA.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia

Difference between Servlet and JSP.docx

  • 1. Difference between Servlet and JSP Brief Introduction: A servlet is a Java class which is used to extend the capabilities of servers that host applications accessed by means of a request-response model. Servlets are mainly used to extend the applications hosted by webs servers, however, they can respond to other types of requests too. For such applications, HTTP-specific servlet classes are defined by Java Servlet technology. A JSP is a text document which contains two types of text: static data and dynamic data. The static data can be expressed in any text-based format (like HTML, XML, SVG and WML), and the dynamic content can be expressed by JSP elements. Difference between Servlet and JSP SERVLET JSP Servlet is a java code. JSP is a html based code. Writing code for servlet is harder than JSP as it is html in java. JSP is easy to code as it is java in html. Servlet plays a controller role in MVC approach. JSP is the view in MVC approach for showing output. Servlet is faster than JSP. JSP is slower than Servlet because the first step in JSP lifecycle is the translation of JSP to java code and then compile. Servlet can accept all protocol requests. JSP only accept http requests. In Servlet, we can override the service() method. In JSP,we cannot override its service() method. In Servlet by default session management is not enabled, user have to enable it explicitly. In JSP session management is automatically enabled.
  • 2. In Servlet we have to implement everything like business logic and presentation logic in just one servlet file. In JSP business logic is separated from presentation logic by using javaBeans. Modification in Servlet is a time consuming task because it includes reloading, recompiling and restarting the server. JSP modification is fast,just need to click the refresh button.