SlideShare a Scribd company logo
SESSION – 6
By→ Anuj Kumar Singh
Load Servlet on Startup
1. The load-on-startup element of web-app loads the servlet at the time
of deployment or server start if value is positive. It is also known
as pre initialization of servlet.
2. You can pass positive and negative value for the servlet.
Advantage of load-on-startup element
1. Servlet is loaded at first request. That means it consumes less time
at first request.
2. If you specify the load-on-startup in web.xml, servlet will be loaded
at project deployment time or server start.
3. So, it will take less time for responding to first request.
Passing positive value
If you pass the positive value, the lower integer value servlet will be
loaded before the higher integer value servlet. In other words,
container loads the Servlets in ascending integer value. The 0 value
will be loaded first then 1, 2, 3 and so on.
Example
This <load-on-startup>0</load-on-startup> Decreases your time for
starting Servlet file.
The value
0,1,2,3 and
so on
There are defined FirstServlets, this servlets will be loaded at the time of
project deployment or server start.
Servlet request Interfaces
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 information's, attributes etc.
Methods of ServletRequest interface
Following are some methods define in the ServletRequest interfaces
Method Description
public String getParameter(String name) is used to obtain the value of a parameter by name.
public String[] getParameterValues(String
name)
returns an array of String containing all values of given parameter name. It
is mainly used to obtain values of a Multi select list box.
java.util.Enumeration getParameterNames() returns an enumeration of all of the request parameter names.
public int getContentLength() Returns the size of the request entity data, or -1 if not known.
public String getCharacterEncoding() Returns the character set encoding for the input of this request.
public String getContentType() Returns the Internet Media Type of the request entity data, or null if not
known.
public ServletInputStream getInputStream()
throws IOException
Returns an input stream for reading binary data in the request body.
public abstract String getServerName() Returns the host name of the server that received the request.
public int getServerPort() Returns the port number on which this request was received.
Example of ServletRequest to display the name of the user
index.html
NewServlet.java
Output
Servlet   session 6

More Related Content

What's hot (20)

PPTX
Javascript: master this
Barak Drechsler
 
PDF
Send Email In Asp.Net
Inayat Ali Jan
 
DOC
Socket
Amandeep Kaur
 
PPTX
Chapter 6.3
sotlsoc
 
ODP
Xml processing in scala
Knoldus Inc.
 
PPTX
Tools ProdigyView
ProdigyView
 
PPT
Servlet client request
chauhankapil
 
PPTX
Handling inputs via scanner class
simarsimmygrewal
 
PPT
Iterator Design Pattern
Varun Arora
 
PPT
ppt on scanner class
deepsxn
 
PDF
Lecture: Advanced Reflection. MetaLinks
Marcus Denker
 
PPTX
Using expression filter
Rahul Kumar
 
PDF
WPF DATA BINDING CHEATSHEET V1.1
Vikas Pandey
 
PPTX
Using message enricher
Son Nguyen
 
PPTX
M expression
Vasanthii Chowdary
 
PPTX
Servlet Filters
Wings Interactive
 
PPTX
Python component in mule
Ramakrishna kapa
 
PPT
Create and analyse programs
Dr. C.V. Suresh Babu
 
PDF
DNS server configuration in packet tracer
prodhan999
 
PPT
Intro To Scala
chambeda
 
Javascript: master this
Barak Drechsler
 
Send Email In Asp.Net
Inayat Ali Jan
 
Chapter 6.3
sotlsoc
 
Xml processing in scala
Knoldus Inc.
 
Tools ProdigyView
ProdigyView
 
Servlet client request
chauhankapil
 
Handling inputs via scanner class
simarsimmygrewal
 
Iterator Design Pattern
Varun Arora
 
ppt on scanner class
deepsxn
 
Lecture: Advanced Reflection. MetaLinks
Marcus Denker
 
Using expression filter
Rahul Kumar
 
WPF DATA BINDING CHEATSHEET V1.1
Vikas Pandey
 
Using message enricher
Son Nguyen
 
M expression
Vasanthii Chowdary
 
Servlet Filters
Wings Interactive
 
Python component in mule
Ramakrishna kapa
 
Create and analyse programs
Dr. C.V. Suresh Babu
 
DNS server configuration in packet tracer
prodhan999
 
Intro To Scala
chambeda
 

Similar to Servlet session 6 (20)

PPT
Servlet11
patinijava
 
PDF
Sun certifiedwebcomponentdeveloperstudyguide
Alberto Romero Jiménez
 
PPTX
SCWCD : The servlet container : CHAP : 4
Ben Abdallah Helmi
 
PDF
Bt0083 server side programing 2
Techglyphs
 
PDF
ServletConfig & ServletContext
ASHUTOSH TRIVEDI
 
PPT
Java servlet life cycle - methods ppt
kamal kotecha
 
PPTX
Java Servlets
Emprovise
 
PDF
Servletand sessiontracking
vamsi krishna
 
PPT
Servlet Part 2
vikram singh
 
RTF
Servlet lifecycle
Durga Devi Thulluri
 
PPTX
Request dispacther interface ppt
Taha Malampatti
 
PDF
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Tushar B Kute
 
ODP
servlet 2.5 & JSP 2.0
megrhi haikel
 
PPTX
Servlets
Akshay Ballarpure
 
PPT
Java Servlets
BG Java EE Course
 
PPTX
Integrating Servlets and JSP (The MVC Architecture)
Amit Ranjan
 
PDF
Bt0083 server side programing
Techglyphs
 
PDF
Working with Servlets
People Strategists
 
PPT
Basics Of Servlet
Shubhani Jain
 
Servlet11
patinijava
 
Sun certifiedwebcomponentdeveloperstudyguide
Alberto Romero Jiménez
 
SCWCD : The servlet container : CHAP : 4
Ben Abdallah Helmi
 
Bt0083 server side programing 2
Techglyphs
 
ServletConfig & ServletContext
ASHUTOSH TRIVEDI
 
Java servlet life cycle - methods ppt
kamal kotecha
 
Java Servlets
Emprovise
 
Servletand sessiontracking
vamsi krishna
 
Servlet Part 2
vikram singh
 
Servlet lifecycle
Durga Devi Thulluri
 
Request dispacther interface ppt
Taha Malampatti
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Tushar B Kute
 
servlet 2.5 & JSP 2.0
megrhi haikel
 
Java Servlets
BG Java EE Course
 
Integrating Servlets and JSP (The MVC Architecture)
Amit Ranjan
 
Bt0083 server side programing
Techglyphs
 
Working with Servlets
People Strategists
 
Basics Of Servlet
Shubhani Jain
 
Ad

More from Anuj Singh Rajput (20)

PPTX
Web technology
Anuj Singh Rajput
 
PPTX
Java script
Anuj Singh Rajput
 
PPTX
Html (hypertext markup language)
Anuj Singh Rajput
 
PPTX
Bootstrap
Anuj Singh Rajput
 
PPTX
Jsp session 13
Anuj Singh Rajput
 
PPTX
Jsp session 12
Anuj Singh Rajput
 
PPTX
Jsp session 11
Anuj Singh Rajput
 
PPTX
Jsp session 10
Anuj Singh Rajput
 
PPTX
Jsp session 9
Anuj Singh Rajput
 
PPTX
Jsp session 8
Anuj Singh Rajput
 
PPTX
Jsp session 7
Anuj Singh Rajput
 
PPTX
Jsp session 6
Anuj Singh Rajput
 
PPTX
Jsp session 5
Anuj Singh Rajput
 
PPTX
Jsp session 4
Anuj Singh Rajput
 
PPTX
Jsp session 3
Anuj Singh Rajput
 
PPTX
Jsp session 2
Anuj Singh Rajput
 
PPTX
Jsp session 1
Anuj Singh Rajput
 
PPTX
Servlet session 14
Anuj Singh Rajput
 
PPTX
Servlet session 13
Anuj Singh Rajput
 
Web technology
Anuj Singh Rajput
 
Java script
Anuj Singh Rajput
 
Html (hypertext markup language)
Anuj Singh Rajput
 
Jsp session 13
Anuj Singh Rajput
 
Jsp session 12
Anuj Singh Rajput
 
Jsp session 11
Anuj Singh Rajput
 
Jsp session 10
Anuj Singh Rajput
 
Jsp session 9
Anuj Singh Rajput
 
Jsp session 8
Anuj Singh Rajput
 
Jsp session 7
Anuj Singh Rajput
 
Jsp session 6
Anuj Singh Rajput
 
Jsp session 5
Anuj Singh Rajput
 
Jsp session 4
Anuj Singh Rajput
 
Jsp session 3
Anuj Singh Rajput
 
Jsp session 2
Anuj Singh Rajput
 
Jsp session 1
Anuj Singh Rajput
 
Servlet session 14
Anuj Singh Rajput
 
Servlet session 13
Anuj Singh Rajput
 
Ad

Recently uploaded (20)

PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
PPTX
Translation_ Definition, Scope & Historical Development.pptx
DhatriParmar
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PDF
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PPTX
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
Cybersecurity: How to Protect your Digital World from Hackers
vaidikpanda4
 
PPTX
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
Translation_ Definition, Scope & Historical Development.pptx
DhatriParmar
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
Cybersecurity: How to Protect your Digital World from Hackers
vaidikpanda4
 
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 

Servlet session 6

  • 1. SESSION – 6 By→ Anuj Kumar Singh
  • 2. Load Servlet on Startup 1. The load-on-startup element of web-app loads the servlet at the time of deployment or server start if value is positive. It is also known as pre initialization of servlet. 2. You can pass positive and negative value for the servlet. Advantage of load-on-startup element 1. Servlet is loaded at first request. That means it consumes less time at first request. 2. If you specify the load-on-startup in web.xml, servlet will be loaded at project deployment time or server start. 3. So, it will take less time for responding to first request.
  • 3. Passing positive value If you pass the positive value, the lower integer value servlet will be loaded before the higher integer value servlet. In other words, container loads the Servlets in ascending integer value. The 0 value will be loaded first then 1, 2, 3 and so on. Example This <load-on-startup>0</load-on-startup> Decreases your time for starting Servlet file.
  • 4. The value 0,1,2,3 and so on There are defined FirstServlets, this servlets will be loaded at the time of project deployment or server start.
  • 5. Servlet request Interfaces 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 information's, attributes etc. Methods of ServletRequest interface Following are some methods define in the ServletRequest interfaces
  • 6. Method Description public String getParameter(String name) is used to obtain the value of a parameter by name. public String[] getParameterValues(String name) returns an array of String containing all values of given parameter name. It is mainly used to obtain values of a Multi select list box. java.util.Enumeration getParameterNames() returns an enumeration of all of the request parameter names. public int getContentLength() Returns the size of the request entity data, or -1 if not known. public String getCharacterEncoding() Returns the character set encoding for the input of this request. public String getContentType() Returns the Internet Media Type of the request entity data, or null if not known. public ServletInputStream getInputStream() throws IOException Returns an input stream for reading binary data in the request body. public abstract String getServerName() Returns the host name of the server that received the request. public int getServerPort() Returns the port number on which this request was received.
  • 7. Example of ServletRequest to display the name of the user index.html