SlideShare a Scribd company logo
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Topics to be covered
Introduction to WEB
WEB & HTTP
HTTP Request & Response
What are Servlets?
Servlet Classes & Interfaces
Servlet Architecture
Generic Servlets
Servlet Request & Response
CGI vs Servlets
Introduction to
WEB
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Introduction to Web
Request
Response is sent to client
Client Server
Web is basically a system of Internet servers that support specially formatted documents
WEB & HTTP
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Web & HTTP
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Web & HTTP
HTTP is a protocol that clients and servers use
on the web to communicate.
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
HTTP Request & Response
HTTP Request
HTTP Response
Client Server
HTTP Response is the packet of information sent by Server to the Client
in response to an earlier Request made by Client
HTTP Request is a packet of Information that one computer sends to another
computer to communicate something
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Difference between HTTP Get & Post
HTTP GET
Operation
HTTP POST
▪ Data is sent in header ▪ Data is sent in request body
▪ Not secured ▪ It is secured
▪ Can be bookmarked ▪ Cannot be bookmarked
▪ Limited data can be sent ▪ Large amount of data can be sent
Introduction to
Servlets
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
What are Servlets?
Creates Web Application
Provides Interfaces & Classes
Must be implemented to create Servlet
Robust & Scalable
Deployed to create Web Page
Responds to any incoming requests
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
What are Servlets?
Request
Response is generated at runtimeResponse is sent to client
Client Server
CGI VS Servlets
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
What is CGI?
Common Gateway Interface (CGI) is a standard for writing programs that can interact through a Web
server with a client running a Web browser.
High Response Time Low Response Time
Not Secure Secure
Not Scalable Highly Scalable
CGI
VS
SERVLET
Servlet
Architecture
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Servlet Architecture
Web Browser
DatabaseServlet ProgramHTTP Server
HTTP Protocol
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Servlet Life Cycle
Handling Request
Loading &
Instantiation
Initialized
End
Start
Stop
init()
service()
destroy()
End of
Request
thread
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Steps to create Simple Servlet
Create and compile simple servlet code
1
Start Apache Tomcat
3
Add mappings to web.xml file
2
Start Web Browser & Request Servlet
4
Generic Servlet
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Generic Servlet
A generic servlet is a
protocol independent
Servlet that should always
override the service()
method to handle the client
request..
Generic Servlet is
easier to write
It has a very simple life cycle
methods
To write Generic Servlet you just
need to extend
javax.servlet.GenericServlet and
override the service() method
Pros
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Request & Response
Servlet Request
Servlet Response
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Request & Response
Servlet Response
Servlet Request
An object of ServletRequest is used to provide the client request
information to a servlet such as content type, content length,
parameter names and values, header informations, attributes etc.
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Request & Response
Servlet Response
Servlet Request
An object of ServletResponse is used to write the information back
to the client.
Servlet Classes
& Interface
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Servlet Classes & Interfaces
Servlet Declares life cycle method of servlet
ServletConfig Allows servlet to get Initialization methods
ServletContext Enables servlet to log access and access information
ServletRequest Used to read data from client request
ServletResponse Used to write data to client response
GenericServlet Implements servlet and Servlet.Config Interface
ServletInputStream Provides input stream to read requests from the client
ServletOutputStream Provides output stream to write responses to the client
ServletException Indicates servlet error has occured
UnavailableException Indicates servlet is not available
HttpServlet Provides methods to handle Http Request and Response
HttpServletRequest Enables servlets to read data from Http Request
HttpServletResponse Enables servlets to write data to Http Response
Java Servlets Tutorial | Introduction to Servlets | Java Certification Training | Edureka

More Related Content

What's hot (20)

PDF
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Edureka!
 
PDF
Chapter 2 : Inet Address & Data Stream
Ministry of Higher Education
 
PPTX
Introduction to Node.js
Vikash Singh
 
PPTX
Web api
Sudhakar Sharma
 
PDF
REST APIs with Spring
Joshua Long
 
PPTX
Polymorphism in c++(ppt)
Sanjit Shaw
 
PPTX
Laravel Tutorial PPT
Piyush Aggarwal
 
PPTX
RESTful API - Best Practices
Tricode (part of Dept)
 
PDF
Intrusion Detection System Project Report
Raghav Bisht
 
PPTX
REST API
Tofazzal Ahmed
 
PPT
JDBC – Java Database Connectivity
Information Technology
 
PPTX
Introduction to APIs (Application Programming Interface)
Vibhawa Nirmal
 
PPT
Introduction to the Web API
Brad Genereaux
 
PPTX
Angularjs PPT
Amit Baghel
 
PDF
Secure Session Management
GuidePoint Security, LLC
 
PDF
JavaScript Programming
Sehwan Noh
 
PPTX
Spring Boot
Jiayun Zhou
 
PPTX
Rest api with node js and express
GirlsInTechnology Nepal
 
PPT
Cross Site Request Forgery
Tony Bibbs
 
PPTX
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Edureka!
 
Chapter 2 : Inet Address & Data Stream
Ministry of Higher Education
 
Introduction to Node.js
Vikash Singh
 
REST APIs with Spring
Joshua Long
 
Polymorphism in c++(ppt)
Sanjit Shaw
 
Laravel Tutorial PPT
Piyush Aggarwal
 
RESTful API - Best Practices
Tricode (part of Dept)
 
Intrusion Detection System Project Report
Raghav Bisht
 
REST API
Tofazzal Ahmed
 
JDBC – Java Database Connectivity
Information Technology
 
Introduction to APIs (Application Programming Interface)
Vibhawa Nirmal
 
Introduction to the Web API
Brad Genereaux
 
Angularjs PPT
Amit Baghel
 
Secure Session Management
GuidePoint Security, LLC
 
JavaScript Programming
Sehwan Noh
 
Spring Boot
Jiayun Zhou
 
Rest api with node js and express
GirlsInTechnology Nepal
 
Cross Site Request Forgery
Tony Bibbs
 
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 

Similar to Java Servlets Tutorial | Introduction to Servlets | Java Certification Training | Edureka (20)

PDF
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification...
Edureka!
 
PPTX
Servlets
ZainabNoorGul
 
PPTX
Servlet in java , java servlet , servlet servlet and CGI, API
PRIYADARSINISK
 
PPTX
Session 25 - Introduction to JEE, Servlets
PawanMM
 
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
WebStackAcademy
 
PPTX
Java servlets
yuvarani p
 
PPTX
Chapter 3 servlet & jsp
Jafar Nesargi
 
PPT
Servlets
Sasidhar Kothuru
 
PDF
Lecture 2: Servlets
Fahad Golra
 
PDF
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Tushar B Kute
 
PPTX
WEB TECHNOLOGY Unit-3.pptx
karthiksmart21
 
PDF
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
RTF
Marata
Cecille Marata
 
PPTX
java Servlet technology
Tanmoy Barman
 
PPT
Anintroductiontojavawebtechnology 090324184240-phpapp01
raviIITRoorkee
 
PPTX
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
PPT
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
sindhu991994
 
PPTX
Servlets api overview
ramya marichamy
 
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification...
Edureka!
 
Servlets
ZainabNoorGul
 
Servlet in java , java servlet , servlet servlet and CGI, API
PRIYADARSINISK
 
Session 25 - Introduction to JEE, Servlets
PawanMM
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
WebStackAcademy
 
Java servlets
yuvarani p
 
Chapter 3 servlet & jsp
Jafar Nesargi
 
Lecture 2: Servlets
Fahad Golra
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Tushar B Kute
 
WEB TECHNOLOGY Unit-3.pptx
karthiksmart21
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
java Servlet technology
Tanmoy Barman
 
Anintroductiontojavawebtechnology 090324184240-phpapp01
raviIITRoorkee
 
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
sindhu991994
 
Servlets api overview
ramya marichamy
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 

Java Servlets Tutorial | Introduction to Servlets | Java Certification Training | Edureka

  • 1. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
  • 2. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Topics to be covered Introduction to WEB WEB & HTTP HTTP Request & Response What are Servlets? Servlet Classes & Interfaces Servlet Architecture Generic Servlets Servlet Request & Response CGI vs Servlets
  • 4. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Introduction to Web Request Response is sent to client Client Server Web is basically a system of Internet servers that support specially formatted documents
  • 6. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Web & HTTP
  • 7. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Web & HTTP HTTP is a protocol that clients and servers use on the web to communicate.
  • 8. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training HTTP Request & Response HTTP Request HTTP Response Client Server HTTP Response is the packet of information sent by Server to the Client in response to an earlier Request made by Client HTTP Request is a packet of Information that one computer sends to another computer to communicate something
  • 9. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Difference between HTTP Get & Post HTTP GET Operation HTTP POST ▪ Data is sent in header ▪ Data is sent in request body ▪ Not secured ▪ It is secured ▪ Can be bookmarked ▪ Cannot be bookmarked ▪ Limited data can be sent ▪ Large amount of data can be sent
  • 11. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training What are Servlets? Creates Web Application Provides Interfaces & Classes Must be implemented to create Servlet Robust & Scalable Deployed to create Web Page Responds to any incoming requests
  • 12. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training What are Servlets? Request Response is generated at runtimeResponse is sent to client Client Server
  • 14. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training What is CGI? Common Gateway Interface (CGI) is a standard for writing programs that can interact through a Web server with a client running a Web browser. High Response Time Low Response Time Not Secure Secure Not Scalable Highly Scalable CGI VS SERVLET
  • 16. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Servlet Architecture Web Browser DatabaseServlet ProgramHTTP Server HTTP Protocol
  • 17. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Servlet Life Cycle Handling Request Loading & Instantiation Initialized End Start Stop init() service() destroy() End of Request thread
  • 18. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Steps to create Simple Servlet Create and compile simple servlet code 1 Start Apache Tomcat 3 Add mappings to web.xml file 2 Start Web Browser & Request Servlet 4
  • 20. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Generic Servlet A generic servlet is a protocol independent Servlet that should always override the service() method to handle the client request.. Generic Servlet is easier to write It has a very simple life cycle methods To write Generic Servlet you just need to extend javax.servlet.GenericServlet and override the service() method Pros
  • 21. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Request & Response Servlet Request Servlet Response
  • 22. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Request & Response Servlet Response Servlet Request An object of ServletRequest is used to provide the client request information to a servlet such as content type, content length, parameter names and values, header informations, attributes etc.
  • 23. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Request & Response Servlet Response Servlet Request An object of ServletResponse is used to write the information back to the client.
  • 25. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Servlet Classes & Interfaces Servlet Declares life cycle method of servlet ServletConfig Allows servlet to get Initialization methods ServletContext Enables servlet to log access and access information ServletRequest Used to read data from client request ServletResponse Used to write data to client response GenericServlet Implements servlet and Servlet.Config Interface ServletInputStream Provides input stream to read requests from the client ServletOutputStream Provides output stream to write responses to the client ServletException Indicates servlet error has occured UnavailableException Indicates servlet is not available HttpServlet Provides methods to handle Http Request and Response HttpServletRequest Enables servlets to read data from Http Request HttpServletResponse Enables servlets to write data to Http Response