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()
).
-
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.
getServletContext
public abstract ServletContext getServletContext()
- Returns the context for the servlet.
getInitParameter
public abstract 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 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.
All Packages Class Hierarchy This Package Previous Next Index