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

PPTX
Introduction to Spring Framework
PDF
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
PPT
PPTX
Advance Java Topics (J2EE)
PPTX
SQLite database in android
PPT
Jsp ppt
PPTX
Web container and Apache Tomcat
PPTX
Classes, objects in JAVA
Introduction to Spring Framework
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Advance Java Topics (J2EE)
SQLite database in android
Jsp ppt
Web container and Apache Tomcat
Classes, objects in JAVA

What's hot (20)

PPT
Java tutorial PPT
PPTX
Servlets
PPT
Angular 8
PPTX
Java Server Pages(jsp)
PPTX
oops concept in java | object oriented programming in java
PPTX
Spring Framework
PPTX
Socket programming in Java (PPTX)
PPTX
Chapter 3 servlet & jsp
PPT
Data Storage In Android
PPTX
Java Server Pages
PDF
Documenting Software Architectures
PPTX
Java beans
PDF
Java Basic Oops Concept
PPT
Java Streams
PPTX
Introduction to ASP.NET
PDF
JUnit & Mockito, first steps
PPT
Visula C# Programming Lecture 1
PPTX
Client side scripting using Javascript
PPT
Java Arrays
Java tutorial PPT
Servlets
Angular 8
Java Server Pages(jsp)
oops concept in java | object oriented programming in java
Spring Framework
Socket programming in Java (PPTX)
Chapter 3 servlet & jsp
Data Storage In Android
Java Server Pages
Documenting Software Architectures
Java beans
Java Basic Oops Concept
Java Streams
Introduction to ASP.NET
JUnit & Mockito, first steps
Visula C# Programming Lecture 1
Client side scripting using Javascript
Java Arrays
Ad

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

PDF
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification...
PPTX
Servlets
PPTX
Servlet in java , java servlet , servlet servlet and CGI, API
PPTX
Session 25 - Introduction to JEE, Servlets
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
PPTX
Java servlets
PDF
Lecture 2: Servlets
PDF
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
PPTX
WEB TECHNOLOGY Unit-3.pptx
PDF
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
RTF
PPTX
java Servlet technology
PPT
Anintroductiontojavawebtechnology 090324184240-phpapp01
PPTX
UNIT - 5.pptx Servlets And Database Connectivity
PPT
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
PPTX
Servlets api overview
PPT
JAVA Servlets
PPT
Servlet (1) also contains code to create it.ppt
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification...
Servlets
Servlet in java , java servlet , servlet servlet and CGI, API
Session 25 - Introduction to JEE, Servlets
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Java servlets
Lecture 2: Servlets
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
WEB TECHNOLOGY Unit-3.pptx
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
java Servlet technology
Anintroductiontojavawebtechnology 090324184240-phpapp01
UNIT - 5.pptx Servlets And Database Connectivity
192563547-Servletsjhb,mnjhjhjm,nm,-Pres-ppt.ppt
Servlets api overview
JAVA Servlets
Servlet (1) also contains code to create it.ppt
Ad

More from Edureka! (20)

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

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Approach and Philosophy of On baking technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Review of recent advances in non-invasive hemoglobin estimation
MIND Revenue Release Quarter 2 2025 Press Release
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Approach and Philosophy of On baking technology

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