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