javax.servlethtml
public interface ServletConfig
A servlet configuration object used by a servlet container to pass information to a servlet during initialization.java
在servlet初始化过程当中,web容器(好比tomcat)会使用ServletConfig来向servlet传递信息。web
Method Summary | |
---|---|
java.lang.String |
getInitParameter(java.lang.String name) Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist. |
java.util.Enumeration |
getInitParameterNames() ; on parameters as an Enumeration of String objects, or an emptyEnumeration if the servlet has no initialization parameters. |
ServletContext |
getServletContext() Returns a reference to the ServletContext in which the caller is executing. |
java.lang.String |
getServletName() Returns the name of this servlet instance. |
对于 getServletName() 的获得的值在web.xml 中是这样的定义的:api
<servlet-name>XXXServlet</servlet-name> tomcat