• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Servlet » introduction » Implementing Servlet Object
Next →
← Prev

Implementing Servlet Object

By Dinesh Thakur

The Servlet object is a Java object that is initiated and managed by the Servlet container. However, the Java object needs to be implemented descriptive to the Servlet container. The following rules are specified by the Java Servlet specification for implementing the Servlet object:

• Should be a public non-abstract class.

• Should be a subtype of the javax.servlet.Servlet interface, as the Servlet container understands the Servlet object by using this interface.

• Should support a no-argument constructor.

• Recommended not to declare the methods of the javax.servlet.Servlet interface implemented by the Servlet object as final.

As we understood the rules for implementing servlet object, let us learn about the  javax.servlet.Servlet andjavax.servlet.ServletConfig interfaces,which arethe basic and important elements of Java Servlet API to understand the Servlet life cycle.

 

We’ll be covering the following topics in this tutorial:

  • ServletConfig OBJECT
  • ServletContext Object

ServletConfig OBJECT

 

• It is one per Servlet Class Object so it is called right hand object of the servlet class object.

 

• ServletContainer creates this object along with our servlet class object and also destroys this object along with our Servlet class object.

 

• This is the object of underlying Servlet Container Supplied java class that implements javax.servlet.ServletConf ig interface.

 

• This object is useful to gather details about Servlet program and to pass information to servlet program.

 

• This object is useful to gather unit parameter values from web.xml file.

 

• This object is required to get access to ServletContext object.

 

ServletContext Object

 

• It is one per web application and visible to all web resource programs of the web application, it is called global memory of the web application.

 

• Servlet Container creates this object either during server startup (cold deployment) or during deployment of the web application (hot deployment) using this object.

 

(a) We can get underlying server info.

 

(b) We can get details of the web resource program of the web.

 

(c) We can get servlet API version that server uses.

 

(d) We can get streams pointing to the resource program of the web application.

 

(e) We can write message to long files.

 

•Different ways of access to ServletConfig obj.in our Servlet program.

You’ll also like:

  1. Difference between the REQUESTDISPATCHER Object and SERVLETCONTEXT Object
  2. What is the Servlet container raises the life cycle events in servlet program?
  3. Implementing Runnable
  4. Problems in Implementing MIS
  5. Implementing Inheritance in Java Example
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

Servlet Tutorials

Servlet Tutorials

  • Servlet - Home
  • Servlet - Types
  • Servlet - Advantages
  • Servlet - Container
  • Servlet - API
  • Servlet - Chaining
  • Servlet - Life Cycle
  • Servlet - Developement Way
  • Servlet - Servlet Vs CGI
  • Servlet - Server Side
  • Servlet - HttpServletRequest
  • Servlet - Cookies Advantages
  • Servlet - JDBC Architecture
  • Servlet - HttpServlet
  • Servlet - HttpServletResponse
  • Servlet - Web Technology
  • Servlet - Applet Communication
  • Servlet - Html Communication
  • Servlet - HTTP POST Request
  • Servlet - HTTP GET Request

Other Links

  • Servlet - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW