22
Servlet to develop the web application dynamically Presented By Infocampus

Advance java training in bangalore

Embed Size (px)

Citation preview

Page 1: Advance java training in bangalore

Servlet to develop the

web application dynamically

Presented ByInfocampus

Page 2: Advance java training in bangalore

Servlet is used to develop the web application ( web application resides at server side and creates dynamic web page).

There are many interfaces and classes in the servlet API such as Servlet, GenericServlet, HttpServlet, ServletRequest, ServletResponse etc.

Page 3: Advance java training in bangalore

Before Servlet, CGI (Common Gateway Interface) scripting language was used as a server-side scripting language.

But CGI was having many disadvantages .

Advance Java Training in Bangalore

Page 4: Advance java training in bangalore

CGI technology enables the web server to callan external program and pass HTTP requestinformation to the external program to processthe request.

For each request, it needs to start a newprocess.

CCGI(Common Gateway Interface)

Infocampus Software Training Institute

Page 5: Advance java training in bangalore

Disadvantages of CGI

1) If number of clients request increases, it takes more time for sending response.2) For each request, it needs to start a process and Web server is limited to start processes.3) It uses language which are platform dependent for example C, C++, perl.

Page 6: Advance java training in bangalore

What is Servlet ?

Java Course in Bangalore

What is Servlet

Page 7: Advance java training in bangalore

- Servlet is a technology which is used to create web application.- Servlet is an API(Application Programming Interface) which gives many interfaces and classes including documentations.

Infocampus Software Training Institute

Page 8: Advance java training in bangalore

- Servlet is an interface that must be implemented for creating any servlet.- Servlet is a class that extend the capabilities of the servers and respond to the request. - Servlet is a web component which is deployed on the server to create dynamic web page.

Page 9: Advance java training in bangalore

Advantages of

Servlet

Page 10: Advance java training in bangalore

1.Good Performance: because it creates a

thread for each request .

2.Portable:because it uses java language.

3.Robust:Servlets are managed by JVM so we don't

need to worry about memory leak , garbage collection etc.

4.More Secure:because it uses java language..

Java Training Center Bangalore

Page 11: Advance java training in bangalore

Servlet Life Cycle

Page 12: Advance java training in bangalore

A servlet life cycle can be defined as the entire process from its creation to the destruction. The following are the ways followed by a servlet

- The servlet is initialized by calling the init () method.

Page 13: Advance java training in bangalore

-The servlet calls service() method to process a client's request.-The servlet is exit by calling the destroy() method.-Finally, servlet is garbage collected by the garbage collector of the JVM.

Infocampus Software Training Institute

Page 14: Advance java training in bangalore

The init() method :The init method is invoked only once. init() is

invoked when the servlet is first created, and not invoked again for each user request. So, it is used for one-time initializations.

The init() method creates or loads some data that will be used throughout the life of the servlet.

Page 15: Advance java training in bangalore

The service() method :The service() method is the main method to perform the task. The servlet container (i.e. web server) calls the service() method to handle requests coming from the user ( browsers) and to write the formatted response back to the user.

Java/j2ee classes bangalore

Page 16: Advance java training in bangalore

The destroy() method :The destroy() method is called only once at the end of the life cycle of a servlet.

This method gives servlet a chance to close database connections, halt background threads, write cookie lists or hit counts to disk, and perform other such cleanup activities.

Page 17: Advance java training in bangalore

Use of Servlet

Page 18: Advance java training in bangalore

1) To accept form input and generate HTML Web pages dynamically.2) As part of middle tiers in enterprise networks by connecting to SQL databases via JDBC.3) In conjunction with applets to provide a high degree of interactivity and dynamic Web content generation.

Java Course in Bangalore

Page 19: Advance java training in bangalore

4) Servlets could act as active agents which share data with each other.5) Servlets could be used for balancing load among servers 6) Protocol support

Page 20: Advance java training in bangalore

Call Infocampus @

9738001024

Enquire at :http://www.infocampus.co.in/java-training-bangalore.html

Page 21: Advance java training in bangalore

Visit at :1

st

& 4th

Floor,Above HDFC BankNear Kalamandir Marathahalli,Bangalore,

Page 22: Advance java training in bangalore

THANK YOU