|
|
Servlet ServletConfig and ServletContext
|
List out the difference between ServletConfig and ServletContext?
Answer
Both are interfaces in the package javax.servlet.
-
ServletConfig is a servlet configuration object. It is used by a servlet
container to pass information to a servlet during initialization.
-
The ServletConfig parameters are specified for a particular servlet and are
unknown to other servlets.
-
The ServletContext object is contained within the ServletConfig object. It is
provided by the web server to the servlet when the servlet is initialized.
-
ServletContext is an interface which has a set of methods like
getServletName(), getServletContext(), getInitParameter(),
getInitParameterNames(). The servlet uses to interact with its servlet
container.
-
ServletContext is common to all servlets within the same web application. So,
servlets use ServletContext to share context information.
|
More Servlets links
Answer - Servlets are the programs that run under web server
environment....
Answer - getSession(true) will check whether a session
already exists for the user..........
Answer - Servlets are Java based analog to CGI programs,
implemented by means of ..........
|
|
|
|
|
|