0% found this document useful (0 votes)
15 views6 pages

Ajp 6

Uploaded by

nihalpatil0021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

Ajp 6

Uploaded by

nihalpatil0021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 6

Servlet Marks-14

Unit Outcome-
1. Explain function of the given method servlet life cycle
2. Use relevant Generic servlet to develop given web based application
3. Use relevant HTTP servlet to develop specified web based application
4. Develop servlet for cookies and session tracking to implement the given
problem
Introduction to servlet
-Servlet Technology is used to create web applications.
-Servlet technology uses Java language to create web applications.
What is CGI
-CGI is actually an external application which is written by using any of the programming languages like C or C++

Disadvantages of CGI
There are many problems in CGI technology:
1.If the number of clients increases, it takes more time for sending the response.
2.For each request, it starts a process, and the web server is limited to start processes.
3.It uses platform dependent language e.g. C,C++
Advantages of Servlet

1.Better performance: because it creates a thread for each request, not process.
2.Portability: because it uses Java language.
3.Robust: JVM manages Servlets, so we don't need to worry about the memory leak, garbage collection, etc.
4.Secure: because it uses java language.
Difference between Servlet and CGI

SERVLET CGI(COMMON GATEWAY INTERFACE)


Servlets are portable and efficient. CGI is not portable
In Servlets, sharing of data is possible. In CGI, sharing of data is not possible.
Servlets can directly communicate with the web CGI cannot directly communicate with the web
server. server.
Servlets are less expensive than CGI. CGI are more expensive than Servlets.
Servlets can handle the cookies. CGI cannot handle the cookies.
Life Cycle of a Servlet

1.Servlet class is loaded.


2.Servlet instance is created.
3.init method is invoked.-
public void init(ServletConfig config) throws ServletException

4.service method is invoked.


-
public void service(ServletRequest request, ServletResponse response)

throws ServletException, IOException

5 destroy method is invoked.


public void destroy()

You might also like