Name

config

Synopsis

Variable Name:

config

Interface Name:

javax.servlet.ServletConfig

Extends:

None

Implemented by:

Internal container-dependent class

JSP Page Type:

Available in both regular JSP pages and error pages

Description

A ServletConfig instance is used by a web container to pass information to a servlet or JSP page during initialization. The configuration information contains initialization parameters (defined in the web application deployment descriptor) and the ServletContext object representing the web application the servlet or JSP page belongs to.

Interface Declaration

public interface ServletConfig {
  public String getInitParameter(String name);
  public Enumeration getInitParameterNames( );
  public ServletContext getServletContext( );
  public String getServletName( );
}

Methods

public String getInitParameter(String name)

Returns a String containing the value of the specified servlet or JSP page initialization parameter, or null if the parameter does not exist.

public java.util.Enumeration getInitParameterNames( )

Returns the names of the servlet’s or JSP page’s initialization parameters as an Enumeration of String objects, or an empty Enumeration if the servlet has no initialization parameters.

public ServletContext getServletContext( )

Returns a reference to the ServletContext that the servlet or JSP page belongs to.

public String getServletName( )

Returns the name of the servlet instance or JSP page. The name may be assigned in the web application deployment descriptor. ...

Get Java Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.