2.2 Servlet API about enterprise edision resourse programing.pptx
SivaKiranBalasani
3 views
16 slides
Mar 23, 2024
Slide 1 of 16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
About This Presentation
this is about full stack backend servlets Today we all are aware of the need to create dynamic web pages i.e. the ones that can change the site contents according to the time or can generate the content according to the request received by the client. If you like coding in Java, then you will be hap...
this is about full stack backend servlets Today we all are aware of the need to create dynamic web pages i.e. the ones that can change the site contents according to the time or can generate the content according to the request received by the client. If you like coding in Java, then you will be happy to know that using Java there also exists a way to generate dynamic web pages and that way is Java Servlet. But before we move forward with our topic let’s first understand the need for server-side extensions.Servlet is a technology which is used to create a web application. Servlet is an API that provides many interfaces and classes including documentation. Servlet is an interface that must be implemented for creating any Servlet. Servlet is a class that extends the capabilities of the servers and responds
Servlet is a technology which is used to create a web application. Servlet is an API that provides many interfaces and classes including documentation. Servlet is an interface that must be implemented for creating any Servlet. Servlet is a class that extends the capabilities of the servers and respondsn Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request, produce the response, then send a response back to the webserver. In Java, to create web applications we use Servlets. To create Java Servlets, we need to use Servlet API which contains all the necessary interfaces and classes. Servlet API has 2 packages namely,
javax.servlet
javax.servlet.http
Size: 1.99 MB
Language: en
Added: Mar 23, 2024
Slides: 16 pages
Slide Content
Java Enterprise
Jakarta Servlet Methods Servlet Classes Servlet Interface Servlets API
S E R V L E T
Servlet API Servlet API contains a number of classes and interfaces that describe the contracts between a servlet class and the runtime environment provided for an instance by a conforming servlet container. Servlet API provides the following two packages that contain its classes and interfaces: javax.servlet .*; Classes and interfaces defines the contracts between a Servlet class and the runtime environment provided for an instance of such a class by a conforming Servlet container. javax.servlet.http .*; Classes and interfaces defines the contracts between a Servlet class running under the HTTP protocol and the runtime environment provided for an instance of such a class by a conforming Servlet container.
Servlet Serialization Servlet Config Generic Servlet Http Servlet User Defined Servlet INTERFACES BUILD IN CLASSES
Generic Servlet Abstract Class GenericServlet implements Servlet interface It defines Servlet generic and independent of protocols It doesn’t give implementation for service method of Servlet interface If your Servlet Generic class, then it should implement service method
Generic Servlet Abstract Class Method
Generic Servlet Abstract Class Method
Http Servlet Abstract Class Method
init service destroy getServletInfo getServletConfig Init method is called by Servlet container to indicate to a Servlet that it is being placed into service. Declaration : void init ( ServletConfig config )
init service destroy getServletInfo getServletConfig Service method is called by the Servlet container to allow the Servlet to respond to a request. Declaration : public void service( HttpServletRequest req , HttpServletResponse res) throws ServletException , java.io.IOException
init service destroy getServletInfo getServletConfig Destroy method indicates that the Servlet is being taken out of service Declaration : public void destroy()
init service destroy getServletInfo getServletConfig getServletInfo method returns information about the Servlet Declaration : public String getServletInfo ()
init service destroy getServletInfo getServletConfig Returns a ServletConfig object that contains initialization and start-up parameters for this Servlet Declaration : public ServletConfig getServletConfig ()