Google News
logo
Java Servlets - Interview Questions
What is servlet attributes and their scope?
Servlet attributes are used for inter-servlet communication, we can set, get and remove attributes in web application. There are three scopes for servlet attributes -  request scope, session scope and application scope.
 
ServletRequest, HttpSession, and ServletContext interfaces provide methods to get/set/remove attributes from request, session and application scope respectively.
 
Servlet attributes are different from init parameters defined in web.xml for ServletConfig or ServletContext.
Advertisement