Newsletter

Understanding ServletConfig and ServletContext

Servlets » on Jan 28, 2013 { 2 Comments } By Sivateja

In our servlet application development, some of the programmers will write fixed coding [ standard lines ], with in the servlet, which is not recommended.  For example, if we write database related code in our servlet, in future if we would like to change any DB credentials in our servlet, we have to open > update > save > compile > re-deploy.  By any chance, what if we need to modify 50+ servlet classes ? its really tedious.

In order to gain the performance of the web application by eliminating the duplicate source code, it is highly recommended to use the fixed technical database details in the web.xml file, web.xml provides external fixed technical details to the servlet.

So in order to develop flexible servlets we make use of web.xml and ServletConfig and ServletContext, let us see one by one in detail.

​​

You Might Also Like

  ::. About the Author .::

Java4s_Author
Sivateja Kandula - Java/J2EE Full Stack Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

2 Responses to “Understanding ServletConfig and ServletContext”
  1. Nischal Tyagi says:

    Its a very easy to understand servlet. Sir can you help me to crack interview easily. I want job in java development give me some tips to find a right job .

  2. Vijay says:

    Thanks Siva Teja, Nice explanation. It is very easy to understand Servlet for Beginners.

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Spring Boot Hibernate Spring
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2024 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.