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
01
02
03
05
06
07
Introduction to Web
Introduction to Servlets
Generic Servlets
Introduction to JSP
Steps to create JSP
JSP Scripting & Directive
Elements
04 08Session Tracking Java Bean Class
Introduction to
WEB
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
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
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
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
Session Tracking
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Session Tracking in Servlets
Session tracking is a way to maintain state(data) of an user
1. Request(new)
3. Second new request
2. Response
Client
Server
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Cookies
URL
rewriting
Hidden
form field
Http
session
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Cookies in Servlet
It is a small piece of information that is persisted between the multiple client requests
1. Request
2. Request + Cookies
3. Response + Cookies
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Useful Methods of Cookie Class
public void setMaxAge(int expiry) Sets the maximum age of the cookies in seconds
public String getName() Returns the name of the cookie. Name cannot be changed after creation
public String getValue() Returns the value of the cookie
public void setName(String name) Changes the name of the cookie
public void setValue(String value) Changes the value of the cookie
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Creating & Deleting a Cookie
Deletion
Creation
1.Cookie ck=new Cookie("user",“Edureka");//creating cookie object
2.response.addCookie(ck);//adding cookie in the response
1.Cookie ck=new Cookie("user","");//deleting value of cookie
2.ck.setMaxAge(0);//changing the maximum age to 0 seconds
3.response.addCookie(ck);//adding cookie in the response
Introduction to
jsp
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
What is JSP?
It is used to create web application just like Servlet technology. Also called as extension of servlet
Fast Development
Tracking User
Easy to maintain
Portable
Powerful
Flexible
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Advantages of JSP over Servlets
JSP
Operation
Servlets
▪ Extension to Servlet ▪ It is not a extension of JSP
▪ No need to recompile and redeploy ▪ Code needs to be recompiled
▪ Less code than servlet ▪ More code comparatively
▪ Easy to maintain ▪ Bit complicated
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Life Cycle of JSP
Buffer
(dynamic content)
Servlet Object
JRE
JSP
Servlet (.java File)
Class file
Compiler
JSP Translator
Steps to create jsp
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Steps to create JSP Page
Create dynamic web project
1
Start Apache Tomcat
3
Create JSP File
2
Deploy the project and get the output
4
Jsp Scripting &
Directive elements
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
JSP Scripting Elements
<% java source code %>scriptlet
<%= statement %>expression
<%! field or method declaration %>declaration
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Implicit Objects of JSP
out Jspwriter
request HttpServletrequest
response HttpServletResponse
config ServletConfig
application ServletContext
session HttpSession
pageContent PageContext
page Object
exception Throwable
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
JSP Directive Elements
<%@ page directive="value” %>Page directive
<%@ include file="resourceName" %>Include directive
<%@ taglib uri="uriofthetaglibrary" prefix="prefixoftaglibrary" %>Taglib directive
Java bean class
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Bean Class
It is a reusable software component. A bean encapsulates many objects into one object, so we can access
this object from multiple places. Moreover, it provides the easy maintenance.
1.<jsp:useBean id= "instanceName" scope= "page | request
| session | application"
2.class= "packageName.className" type= "packageName.clas
sName"
3.beanName="packageName.className | <%= expression >" >
4.</jsp:useBean>
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification Training | Edureka
Ad

Recommended

Java Servlets Tutorial | Introduction to Servlets | Java Certification Traini...
Java Servlets Tutorial | Introduction to Servlets | Java Certification Traini...
Edureka!
 
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Edureka!
 
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Edureka!
 
Java EE7 Demystified
Java EE7 Demystified
Ankara JUG
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
Murat Yener
 
Java EE 7 - Overview and Status
Java EE 7 - Overview and Status
Java Usergroup Berlin-Brandenburg
 
Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)
Hamed Hatami
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Bruno Borges
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
Bert Ertman
 
Java EE Introduction
Java EE Introduction
ejlp12
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and Beyond
Oracle
 
Java EE7 in action
Java EE7 in action
Ankara JUG
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
Reza Rahman
 
JavaFX Uni Parthenope
JavaFX Uni Parthenope
Emanuela Giannetta
 
Java EE 01-Servlets and Containers
Java EE 01-Servlets and Containers
Fernando Gil
 
JEE Course - JEE Overview
JEE Course - JEE Overview
odedns
 
JavaFX and JEE 7
JavaFX and JEE 7
Vijay Nair
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG
 
Rich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFX
Max Katz
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
Advanced JAVA
Advanced JAVA
Rajvi Vaghasiya
 
Java EE 8: On the Horizon
Java EE 8: On the Horizon
Josh Juneau
 
108 advancedjava
108 advancedjava
Anil Kumar
 
Move from J2EE to Java EE
Move from J2EE to Java EE
Hirofumi Iwasaki
 
jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
Java EE vs Spring Framework
Java EE vs Spring Framework
Rohit Kelapure
 
Java EE 8 Recipes
Java EE 8 Recipes
Josh Juneau
 
Bt0083 server side programing
Bt0083 server side programing
Techglyphs
 
IP UNIT III PPT.pptx
IP UNIT III PPT.pptx
ssuser92282c
 

More Related Content

What's hot (20)

JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
Bert Ertman
 
Java EE Introduction
Java EE Introduction
ejlp12
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and Beyond
Oracle
 
Java EE7 in action
Java EE7 in action
Ankara JUG
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
Reza Rahman
 
JavaFX Uni Parthenope
JavaFX Uni Parthenope
Emanuela Giannetta
 
Java EE 01-Servlets and Containers
Java EE 01-Servlets and Containers
Fernando Gil
 
JEE Course - JEE Overview
JEE Course - JEE Overview
odedns
 
JavaFX and JEE 7
JavaFX and JEE 7
Vijay Nair
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG
 
Rich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFX
Max Katz
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
Advanced JAVA
Advanced JAVA
Rajvi Vaghasiya
 
Java EE 8: On the Horizon
Java EE 8: On the Horizon
Josh Juneau
 
108 advancedjava
108 advancedjava
Anil Kumar
 
Move from J2EE to Java EE
Move from J2EE to Java EE
Hirofumi Iwasaki
 
jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
Java EE vs Spring Framework
Java EE vs Spring Framework
Rohit Kelapure
 
Java EE 8 Recipes
Java EE 8 Recipes
Josh Juneau
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
Bert Ertman
 
Java EE Introduction
Java EE Introduction
ejlp12
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and Beyond
Oracle
 
Java EE7 in action
Java EE7 in action
Ankara JUG
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
Reza Rahman
 
Java EE 01-Servlets and Containers
Java EE 01-Servlets and Containers
Fernando Gil
 
JEE Course - JEE Overview
JEE Course - JEE Overview
odedns
 
JavaFX and JEE 7
JavaFX and JEE 7
Vijay Nair
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG
 
Rich Enterprise Applications with JavaFX
Rich Enterprise Applications with JavaFX
Max Katz
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Edureka!
 
Java EE 8: On the Horizon
Java EE 8: On the Horizon
Josh Juneau
 
108 advancedjava
108 advancedjava
Anil Kumar
 
jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
Java EE vs Spring Framework
Java EE vs Spring Framework
Rohit Kelapure
 
Java EE 8 Recipes
Java EE 8 Recipes
Josh Juneau
 

Similar to Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification Training | Edureka (20)

Bt0083 server side programing
Bt0083 server side programing
Techglyphs
 
IP UNIT III PPT.pptx
IP UNIT III PPT.pptx
ssuser92282c
 
Ajax basics
Ajax basics
amanrahulraj
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
UNIT - 5.pptx Servlets And Database Connectivity
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
java Servlet technology
java Servlet technology
Tanmoy Barman
 
Advanced java+JDBC+Servlet
Advanced java+JDBC+Servlet
Anuj Singh Rajput
 
SERVIET
SERVIET
sathish sak
 
Servlets
Servlets
Geethu Mohan
 
Ajax Basics 1
Ajax Basics 1
bhuvanann
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
005428052.pdf
005428052.pdf
KalsoomTahir2
 
Java Servlets.pdf
Java Servlets.pdf
Arumugam90
 
Chap4 4 1
Chap4 4 1
Hemo Chella
 
UNIT-3 Servlet
UNIT-3 Servlet
ssbd6985
 
Ppt for Online music store
Ppt for Online music store
ADEEBANADEEM
 
CS8651 IP Unit 3.pptx
CS8651 IP Unit 3.pptx
Vigneshkumar Ponnusamy
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Tushar B Kute
 
Java servlets
Java servlets
lopjuan
 
Servlet
Servlet
baabtra.com - No. 1 supplier of quality freshers
 
Bt0083 server side programing
Bt0083 server side programing
Techglyphs
 
IP UNIT III PPT.pptx
IP UNIT III PPT.pptx
ssuser92282c
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
UNIT - 5.pptx Servlets And Database Connectivity
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
java Servlet technology
java Servlet technology
Tanmoy Barman
 
Ajax Basics 1
Ajax Basics 1
bhuvanann
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Java Servlets.pdf
Java Servlets.pdf
Arumugam90
 
UNIT-3 Servlet
UNIT-3 Servlet
ssbd6985
 
Ppt for Online music store
Ppt for Online music store
ADEEBANADEEM
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Tushar B Kute
 
Java servlets
Java servlets
lopjuan
 
Ad

More from Edureka! (20)

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

Recently uploaded (20)

AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 

Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | 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 01 02 03 05 06 07 Introduction to Web Introduction to Servlets Generic Servlets Introduction to JSP Steps to create JSP JSP Scripting & Directive Elements 04 08Session Tracking Java Bean Class
  • 4. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Web & HTTP
  • 5. 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.
  • 6. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 13. 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
  • 14. 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
  • 16. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Session Tracking in Servlets Session tracking is a way to maintain state(data) of an user 1. Request(new) 3. Second new request 2. Response Client Server
  • 17. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Cookies URL rewriting Hidden form field Http session
  • 18. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Cookies in Servlet It is a small piece of information that is persisted between the multiple client requests 1. Request 2. Request + Cookies 3. Response + Cookies
  • 19. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Useful Methods of Cookie Class public void setMaxAge(int expiry) Sets the maximum age of the cookies in seconds public String getName() Returns the name of the cookie. Name cannot be changed after creation public String getValue() Returns the value of the cookie public void setName(String name) Changes the name of the cookie public void setValue(String value) Changes the value of the cookie
  • 20. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Creating & Deleting a Cookie Deletion Creation 1.Cookie ck=new Cookie("user",“Edureka");//creating cookie object 2.response.addCookie(ck);//adding cookie in the response 1.Cookie ck=new Cookie("user","");//deleting value of cookie 2.ck.setMaxAge(0);//changing the maximum age to 0 seconds 3.response.addCookie(ck);//adding cookie in the response
  • 22. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training What is JSP? It is used to create web application just like Servlet technology. Also called as extension of servlet Fast Development Tracking User Easy to maintain Portable Powerful Flexible
  • 23. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Advantages of JSP over Servlets JSP Operation Servlets ▪ Extension to Servlet ▪ It is not a extension of JSP ▪ No need to recompile and redeploy ▪ Code needs to be recompiled ▪ Less code than servlet ▪ More code comparatively ▪ Easy to maintain ▪ Bit complicated
  • 24. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Life Cycle of JSP Buffer (dynamic content) Servlet Object JRE JSP Servlet (.java File) Class file Compiler JSP Translator
  • 26. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Steps to create JSP Page Create dynamic web project 1 Start Apache Tomcat 3 Create JSP File 2 Deploy the project and get the output 4
  • 28. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training JSP Scripting Elements <% java source code %>scriptlet <%= statement %>expression <%! field or method declaration %>declaration
  • 29. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Implicit Objects of JSP out Jspwriter request HttpServletrequest response HttpServletResponse config ServletConfig application ServletContext session HttpSession pageContent PageContext page Object exception Throwable
  • 30. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training JSP Directive Elements <%@ page directive="value” %>Page directive <%@ include file="resourceName" %>Include directive <%@ taglib uri="uriofthetaglibrary" prefix="prefixoftaglibrary" %>Taglib directive
  • 32. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Bean Class It is a reusable software component. A bean encapsulates many objects into one object, so we can access this object from multiple places. Moreover, it provides the easy maintenance. 1.<jsp:useBean id= "instanceName" scope= "page | request | session | application" 2.class= "packageName.className" type= "packageName.clas sName" 3.beanName="packageName.className | <%= expression >" > 4.</jsp:useBean>