Name

config

Synopsis

The config variable contains a reference to a ServletConfig instance. A web container uses a ServletConfig instance 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.

Synopsis

Variable name:

config

EL expression

${pageContext.servletConfig}

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

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 the servlet or JSP page belongs to.

public String getServletName( )

Returns the name of this servlet instance or JSP page. The name may be assigned in the web application deployment descriptor. For an unregistered (and thus unnamed) servlet instance or JSP page, the servlet’s class name is returned.

Get JavaServer Pages, 3rd Edition 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.