Interface javax.servlet.ServletConfig
All Packages Class Hierarchy This Package Previous Next Index
Interface javax.servlet.ServletConfig
- public interface ServletConfig
This interface is implemented by services in order to pass
configuration information to a servlet when it is first loaded. A
service writer implementing this interface must write methods for the
servlet to use to get its initialization parameters and the context
in which it is running.
The ServletConfig interface can also be implemented by servlets.
(GenericServlet does this.) When implemented by a servlet, the
methods in the interface make getting the configuration data more
convenient. For example, a servlet could implement
getServletContext by writing,
public ServletContext getServletContext() {
return getServletConfig().getServletContext();
}
making access to the servlet's context object a single method
invocation (a call to getServletContext()
).
- Version:
- 1.16, 10/08/97
-
getInitParameter(String)
-
Returns a string containing the value of the named
initialization parameter of the servlet, or null if the
parameter does not exist.
-
getInitParameterNames()
- Returns the names of the servlet's initialization parameters
as an enumeration of strings, or an empty enumeration if there
are no initialization parameters.
-
getServletContext()
- Returns the context for the servlet.
getInitParameter
public abstract java.lang.String getInitParameter(String name)
- Returns a string containing the value of the named
initialization parameter of the servlet, or null if the
parameter does not exist. Init parameters have a single string
value; it is the responsibility of the servlet writer to
interpret the string.
- Parameters:
- name - the name of the parameter whose value is requested
getInitParameterNames
public abstract java.util.Enumeration getInitParameterNames()
- Returns the names of the servlet's initialization parameters
as an enumeration of strings, or an empty enumeration if there
are no initialization parameters.
getServletContext
public abstract javax.servlet.ServletContext getServletContext()
- Returns the context for the servlet.
All Packages Class Hierarchy This Package Previous Next Index