SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
JSP - Lifecycle
Prof. Neeraj Bhargava
Kapil Chauhan
Department of Computer Science
School of Engineering & Systems Sciences
MDS University, Ajmer
JSP - Lifecycle
 A JSP life cycle is defined as the process from its
creation till the destruction. This is similar to a servlet
life cycle with an additional step which is required to
compile a JSP into servlet.
 The following are the paths followed by a JSP −
 Compilation
 Initialization
 Execution
 Cleanup
Lifecycle
JSP Compilation
 When a browser asks for a JSP, the JSP engine first
checks to see whether it needs to compile the page.
 If the page has never been compiled, or if the JSP has
been modified since it was last compiled, the JSP
engine compiles the page.
JSP Initialization
 When a container loads a JSP it invokes
the jspInit() method before servicing any requests.
 If you need to perform JSP-specific initialization,
override the jspInit() method −
 public void jspInit(){
// Initialization code...
}
JSP Execution
 This phase of the JSP life cycle represents all interactions
with requests until the JSP is destroyed.
 Whenever a browser requests a JSP and the page has been
loaded and initialized, the JSP engine invokes
the _jspService() method in the JSP.
 The _jspService() method takes
an HttpServletRequest and an HttpServletResponse as
its parameters as follows −
 void _jspService(HttpServletRequest request,
HttpServletResponse response) { // Service handling
code... }
JSP Cleanup
 The destruction phase of the JSP life cycle represents
when a JSP is being removed from use by a container.
 The jspDestroy() method is the JSP equivalent of the
destroy method for servlets. Override jspDestroy when
you need to perform any cleanup, such as releasing
database connections or closing open files.
 The jspDestroy() method has the following form −
 public void jspDestroy() {
// Your cleanup code goes here. }

More Related Content

PPT
Jdbc ppt
PPTX
Servlets
PPTX
Java Server Pages(jsp)
PPTX
JAVA AWT
PDF
Remote Method Invocation (RMI)
PPT
Jsp ppt
PPT
Servlet life cycle
PPTX
servlet in java
Jdbc ppt
Servlets
Java Server Pages(jsp)
JAVA AWT
Remote Method Invocation (RMI)
Jsp ppt
Servlet life cycle
servlet in java

What's hot (20)

PPS
Jdbc architecture and driver types ppt
DOCX
Behavioural modelling
PPTX
Chapter 3 servlet & jsp
PPTX
Java web application development
PPTX
Types of Drivers in JDBC
PPSX
JDBC: java DataBase connectivity
PPT
Java Servlets
PPTX
Packages in java
PPT
Java Networking
PPTX
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
PPTX
jstl ( jsp standard tag library )
PPTX
Socket programming in Java (PPTX)
PPT
PPTX
Jdbc ppt
PPTX
Java swing
PPTX
Multithreading in java
PPT
Applet life cycle
PPT
Jdbc architecture and driver types ppt
Behavioural modelling
Chapter 3 servlet & jsp
Java web application development
Types of Drivers in JDBC
JDBC: java DataBase connectivity
Java Servlets
Packages in java
Java Networking
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
jstl ( jsp standard tag library )
Socket programming in Java (PPTX)
Jdbc ppt
Java swing
Multithreading in java
Applet life cycle
Ad

Similar to Jsp lifecycle (20)

PPTX
what.pptxvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
DOCX
Java server pages
PPTX
JAVA SERVER PAGES
PPTX
JSP- JAVA SERVER PAGES
PDF
PPTX
JavaScript, often abbreviated as JS, is a programming language and core techn...
DOCX
Jsp interview questions by java training center
DOCX
Unit 4 web technology uptu
DOCX
Unit 4 1 web technology uptu
PPT
Atul & shubha goswami jsp
PDF
JSP Components and Directives.pdf
PPTX
JSP overview
PPTX
Jsp basic
PPTX
Module 3.pptx.............................
PPTX
The Java Server Page in Java Concept.pptx
PDF
J2EE jsp_01
PPTX
Arpita industrial trainingppt
PPT
J2EE - JSP-Servlet- Container - Components
PDF
Struts Action
what.pptxvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Java server pages
JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
JavaScript, often abbreviated as JS, is a programming language and core techn...
Jsp interview questions by java training center
Unit 4 web technology uptu
Unit 4 1 web technology uptu
Atul & shubha goswami jsp
JSP Components and Directives.pdf
JSP overview
Jsp basic
Module 3.pptx.............................
The Java Server Page in Java Concept.pptx
J2EE jsp_01
Arpita industrial trainingppt
J2EE - JSP-Servlet- Container - Components
Struts Action
Ad

More from chauhankapil (20)

PPTX
Gray level transformation
PPTX
Elements of visual perception
PPTX
JSP Client Request
PPTX
Jsp server response
PPTX
Markov decision process
PPTX
RNN basics in deep learning
PPTX
Introduction to generative adversarial networks (GANs)
PPTX
Bayesian probabilistic interference
PPTX
PPTX
Exception handling in java
PPTX
Knowledge acquistion
PPTX
Knowledge based system
PPTX
Introduction of predicate logics
PPTX
Types of inheritance in java
PPTX
Representation of syntax, semantics and Predicate logics
PPTX
Inheritance in java
PPTX
Propositional logic
PPTX
Constructors in java
PPTX
Methods in java
PPT
Circular linked list
Gray level transformation
Elements of visual perception
JSP Client Request
Jsp server response
Markov decision process
RNN basics in deep learning
Introduction to generative adversarial networks (GANs)
Bayesian probabilistic interference
Exception handling in java
Knowledge acquistion
Knowledge based system
Introduction of predicate logics
Types of inheritance in java
Representation of syntax, semantics and Predicate logics
Inheritance in java
Propositional logic
Constructors in java
Methods in java
Circular linked list

Recently uploaded (20)

PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PPT
Occupational Health and Safety Management System
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PPTX
Current and future trends in Computer Vision.pptx
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
Soil Improvement Techniques Note - Rabbi
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
introduction to high performance computing
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
Information Storage and Retrieval Techniques Unit III
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Occupational Health and Safety Management System
Module 8- Technological and Communication Skills.pptx
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Current and future trends in Computer Vision.pptx
III.4.1.2_The_Space_Environment.p pdffdf
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
August 2025 - Top 10 Read Articles in Network Security & Its Applications
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Soil Improvement Techniques Note - Rabbi
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
introduction to high performance computing
Nature of X-rays, X- Ray Equipment, Fluoroscopy
Exploratory_Data_Analysis_Fundamentals.pdf
Fundamentals of safety and accident prevention -final (1).pptx
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Information Storage and Retrieval Techniques Unit III

Jsp lifecycle

  • 1. JSP - Lifecycle Prof. Neeraj Bhargava Kapil Chauhan Department of Computer Science School of Engineering & Systems Sciences MDS University, Ajmer
  • 2. JSP - Lifecycle  A JSP life cycle is defined as the process from its creation till the destruction. This is similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet.  The following are the paths followed by a JSP −  Compilation  Initialization  Execution  Cleanup
  • 4. JSP Compilation  When a browser asks for a JSP, the JSP engine first checks to see whether it needs to compile the page.  If the page has never been compiled, or if the JSP has been modified since it was last compiled, the JSP engine compiles the page.
  • 5. JSP Initialization  When a container loads a JSP it invokes the jspInit() method before servicing any requests.  If you need to perform JSP-specific initialization, override the jspInit() method −  public void jspInit(){ // Initialization code... }
  • 6. JSP Execution  This phase of the JSP life cycle represents all interactions with requests until the JSP is destroyed.  Whenever a browser requests a JSP and the page has been loaded and initialized, the JSP engine invokes the _jspService() method in the JSP.  The _jspService() method takes an HttpServletRequest and an HttpServletResponse as its parameters as follows −  void _jspService(HttpServletRequest request, HttpServletResponse response) { // Service handling code... }
  • 7. JSP Cleanup  The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a container.  The jspDestroy() method is the JSP equivalent of the destroy method for servlets. Override jspDestroy when you need to perform any cleanup, such as releasing database connections or closing open files.  The jspDestroy() method has the following form −  public void jspDestroy() { // Your cleanup code goes here. }