---
title: "What is difference between ServletConfig and ServletContext?"  
description: "What is difference between ServletConfig and ServletContext?"  
author: "Anonymous User"  
published: 2014-11-03  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/2238/what-is-difference-between-servletconfig-and-servletcontext  
category: "java"  
tags: ["session"]  
reading_time: 1 minute  

---

# What is difference between ServletConfig and ServletContext?

Some of the differences between ServletConfig and ServletContext are:

- ServletConfig is a unique object per servlet whereas ServletContext is a unique object for complete application.
- ServletConfig is used to provide init parameters to the servlet whereas ServletContext is used to provide application level init parameters that all other servlets can use.
- We can’t set attributes in ServletConfig object whereas we can set attributes in ServletContext that other servlets can use in their implementation.

## Answers

### Answer by Anonymous User

Some of the differences between ServletConfig and ServletContext are:

- ServletConfig is a unique object per servlet whereas ServletContext is a unique object for complete application.
- ServletConfig is used to provide init parameters to the servlet whereas ServletContext is used to provide application level init parameters that all other servlets can use.
- We can’t set attributes in ServletConfig object whereas we can set attributes in ServletContext that other servlets can use in their implementation.


---

Original Source: https://www.mindstick.com/interview/2238/what-is-difference-between-servletconfig-and-servletcontext

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
