Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Interface javax.servlet.ServletConfig

Implementing Classes:
GenericServlet

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()).


Method Summary
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.
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.
ServletContext  getServletContext()
Returns the context for the servlet.
 

Method Detail

getServletContext

public ServletContext getServletContext()
Returns the context for the servlet.

getInitParameter

public 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 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.

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.