Get all updates of Java4s
Follow Us: Email 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 Author ♦

Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.


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.


By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

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