Name
config
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 to which the servlet or JSP page belongs.
Methods
-
public String getInitParameter(String name)
Returns a
String
containing the value of the specified servlet or JSP page initialization parameter, ornull
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
ofString
objects, or an emptyEnumeration
if the servlet has no initialization parameters.-
public ServletContext getServletContext()
Returns a reference to the
ServletContext
to which the servlet or JSP page belongs.-
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 Pocket Reference 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.