HOPE FOUNDATION’S
INTERNATIONAL INSTITUTE OF INFORMATION TECHNOLOGY, (I²IT)
www.isquareit.edu.in
+91 20 22933441 / 2
Hope Foundation’s International Institute of Information Technology, I²IT, P-14, Hinjawadi, Pune - 411 057
Servlet: a Server-side Technology
Prepared By
Prof. Kimi Ramteke
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
● Introduction
● Why Servlet?
● CGI Vs Servlet
● What is Servlet?
● Client – Servlet communication
● Servlet over all Working
● Disadvantages
● References
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
● Technologies that exist at the server side.
● Java is important language which is in demand from
decades.
● When it is required to create small application program
using scripting language like JavaScript is sufficient.
● But when Enterprise application program need to be
developed some interfacing is required, so API’s can act
like agent for communication between client and server.
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
● Before Servlet CGI was in use.
● Due to its performance and scalability issue, is has got faded.
● With each new request, web server creates a new operating
system process to execute the CGI/Perl program.
● This slowed down the performance of CGI.
● Whereas servlet uses the threads for every new request as
shown in the figure 1.1.
CGI request Handling Servlet request Handling
Fig.1 How Server handles CGI request [1] Fig.2 How Server handles Servlet request [1]
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
● A piece of a code written in JAVA language.
● Lacks the main method.
● Hence it needs to have some container to run it.
● That container is called as Servlet container.
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
Web Client Web Server
Servlet
container
Servlet
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
Dynamic web page request Direct Communication
Fig. 3 Client- Servlet communication
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
Client Server
Container
Servlet
Init()
Service()
Get() post()
Destroy()
HTML page
HTTP
request
HTTP
response
Get
loaded
into
Execute servlet
to create
Sent
to
Fig. 4 Servlet working
Fig. 5 Servlet life cycle [2]
● Servlet gets loaded in
container/servlet engine
– Int(): creates instance of servlet.
● Happens only for 1st request
– Service():helps to read data from
HTTP request through doget or
dopost methods.
● Happens for all requests
– Destroy(): deletes instance in the
memory.
● Happens on servlet updation or
replacement.
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
● Needs good knowledge of JAVA
● Presentation and business logics are not
separated
● Need to create objects explicitly for required
functionality
● Takes time to develop
Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
[1] "Server-side Technologies“, https://slideplayer.com/slide/6105930/ , 28th April 2022.
[2] “Servlet Life Cycle”, http://www.instanceofjava.com/2014/12/servlet-life-cycle.html, 28th April 2022.
[3] “ Web Technologies”, Achyut Godbole, Atul Kahate, Tata McGraw-Hill Education Pvt. Ltd.
Thank You
For further information please contact
Prof. Kimi Ramteke
Department of Computer Engineering
Hope Foundation’s International Institute of Information Technology, I²IT
Hinjawadi, Pune – 411 057
Phone - +91 20 22933441/9823746576
www.isquareit.edu.in | kimir@isquareit.edu.in

Servlet: A Server-side Technology

  • 1.
    HOPE FOUNDATION’S INTERNATIONAL INSTITUTEOF INFORMATION TECHNOLOGY, (I²IT) www.isquareit.edu.in +91 20 22933441 / 2 Hope Foundation’s International Institute of Information Technology, I²IT, P-14, Hinjawadi, Pune - 411 057 Servlet: a Server-side Technology Prepared By Prof. Kimi Ramteke
  • 2.
    Hope Foundation’s InternationalInstitute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 ● Introduction ● Why Servlet? ● CGI Vs Servlet ● What is Servlet? ● Client – Servlet communication ● Servlet over all Working ● Disadvantages ● References
  • 3.
    Hope Foundation’s InternationalInstitute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 ● Technologies that exist at the server side. ● Java is important language which is in demand from decades. ● When it is required to create small application program using scripting language like JavaScript is sufficient. ● But when Enterprise application program need to be developed some interfacing is required, so API’s can act like agent for communication between client and server.
  • 4.
    Hope Foundation’s InternationalInstitute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 ● Before Servlet CGI was in use. ● Due to its performance and scalability issue, is has got faded. ● With each new request, web server creates a new operating system process to execute the CGI/Perl program. ● This slowed down the performance of CGI. ● Whereas servlet uses the threads for every new request as shown in the figure 1.1.
  • 5.
    CGI request HandlingServlet request Handling Fig.1 How Server handles CGI request [1] Fig.2 How Server handles Servlet request [1] Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
  • 6.
    ● A pieceof a code written in JAVA language. ● Lacks the main method. ● Hence it needs to have some container to run it. ● That container is called as Servlet container. Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
  • 7.
    Web Client WebServer Servlet container Servlet Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Dynamic web page request Direct Communication Fig. 3 Client- Servlet communication
  • 8.
    Hope Foundation’s InternationalInstitute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Client Server Container Servlet Init() Service() Get() post() Destroy() HTML page HTTP request HTTP response Get loaded into Execute servlet to create Sent to Fig. 4 Servlet working
  • 9.
    Fig. 5 Servletlife cycle [2] ● Servlet gets loaded in container/servlet engine – Int(): creates instance of servlet. ● Happens only for 1st request – Service():helps to read data from HTTP request through doget or dopost methods. ● Happens for all requests – Destroy(): deletes instance in the memory. ● Happens on servlet updation or replacement. Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057
  • 10.
    Hope Foundation’s InternationalInstitute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 ● Needs good knowledge of JAVA ● Presentation and business logics are not separated ● Need to create objects explicitly for required functionality ● Takes time to develop
  • 11.
    Hope Foundation’s InternationalInstitute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 [1] "Server-side Technologies“, https://slideplayer.com/slide/6105930/ , 28th April 2022. [2] “Servlet Life Cycle”, http://www.instanceofjava.com/2014/12/servlet-life-cycle.html, 28th April 2022. [3] “ Web Technologies”, Achyut Godbole, Atul Kahate, Tata McGraw-Hill Education Pvt. Ltd.
  • 12.
    Thank You For furtherinformation please contact Prof. Kimi Ramteke Department of Computer Engineering Hope Foundation’s International Institute of Information Technology, I²IT Hinjawadi, Pune – 411 057 Phone - +91 20 22933441/9823746576 www.isquareit.edu.in | kimir@isquareit.edu.in