Back to Top

Monday, 20 February 2012


   Java Servlet API is that Application Program Interface (API), which defines and describes the contracts between servlets and servers. That means, it contains the set of programs and standard instructions to develop a proper access between a servlet and the server. Servlet API is a part of the official J2EE API. This API contains 2 packages with the extension javax. They are as follows.

·        Package javax.servlet
·        Package javax.servlet.http

Package javax.servlet:

  • Package javax.servlet deals with the contracts between a servlet class and the runtime environment offered for an instance of the class, within the servlet container.

  • It contains a set of classes and interfaces. Some important classes and interfaces like, Class GenericServlet which implements Interface Servlet. Apart from that, interfaces like Filter, RequestDispatcher, ServletRequest, ServletResponse, etc. and classes like ServletInputStream, ServletOutputStream, etc are also belong of this package. It also contains 2 exceptions, and they are ServletException and UnavailableException.

Package javax.servlet.http:

  • Package javax.servlet.http deals with the contracts between a servlet class, which is running under HTTP protocol and the runtime environment offered for an instance of the class, within the servlet container.

  • It also contains some important classes and interfaces. Some of them are, Interfaces like HttpSession, HttpServletResponse, HttpServletRequest, HttpSessionBindingListener, etc and classes like Cookie, HttpServlet (which implements Interface Servlet of javax.servlet package), etc.

Uses of Servlet API:
  1. Management of Servlet life cycle.
  2. It provides access to servlet context.
  3. It also provides some utility classes.
  4. And last but not least, it also provides classes to handle HTTP protocol.
Anijit Sarkar

5 Responses to “ J2EE: SERVLET: SERVLET API ”

jaylen watkins said...
12 March 2012 at 15:38

Well experience J2ee stuff. Thanks for this.

Interview Questions

nasir husain said...
31 October 2014 at 17:57

HI, Friends this very usefull java servlet interview questions
for excellent knowledge on java servlet visit

Naviya Nair said...
24 October 2016 at 15:25

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai

Vamshi Krishna said...
1 July 2017 at 17:56

I have seen lot blogs and Information on othersites But in this Java Blog Information is very useful thanks for sharing it........

venu puram said...
5 October 2017 at 12:50

Thankyou for the information I was handling many java projects As I am a PMP Certified Expert where my PMP Course in Mumbai had a great impact on me with different set of elements Well thankyou for the blog Keep Updating.

Post a Comment

Popular Posts

All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar
blog links Web Directory Academics Blogs