1. ServletConfig是什么?
    jakarta.servlet.ServletConfig
    显然ServletConfig是Servlet规范中的一员。
    ServletConfig是一个接口。(jakarta.servlet.Servlet是一个接口。)
    2. 谁去实现了这个接口呢? WEB服务器实现了
    public class org.apache.catalina.core.StandardWrapperFacade implements ServletConfig {}
    结论:Tomcat服务器实现了ServletConfig接口。
    思考:如果把Tomcat服务器换成jetty服务器,输出ServletConfig对象的时候,还是这个结果吗?
    不一定一样,包名类名可能和Tomcat不一样。但是他们都实现了ServletConfig这个规范。
    3. 一个Servlet对象中有一个ServletConfig对象。(Servlet和ServletConfig对象是一对一。)
    100个Servlet,就应该有100个ServletConfig对象。
    4. ServletConfig对象是谁创建的?在什么时候创建的?
    Tomcat服务器(WEB服务器)创建了ServletConfig对象。
    在创建Servlet对象的时候,同时创建ServletConfig对象。
    5. ServletConfig接口到底是干啥的?有什么用呢?
    Config是哪个单词的缩写?
    Configuration
    ServletConfig对象被翻译为:Servlet对象的配置信息对象。
    一个Servlet对象就有一个配置信息对象。
    两个Servlet对象就有两个配置信息对象。

    6. ServletConfig对象中到底包装了什么信息呢?

    1. <servlet>
    2. <servlet-name>configTest</servlet-name>
    3. <servlet-class>configservlet.ServletConfig01</servlet-class>
    4. </servlet>
    1. ServletConfig对象中包装的信息是:<br /> web.xml文件中<servlet></servlet>标签的配置信息。<br /> Tomcat小猫咪解析web.xml文件,将web.xml文件中<servlet></servlet>标签中的配置信息自动包装到ServletConfig对象中。

    7. ServletConfig接口中有哪些方法?

    configTest
    com.bjpowernode.javaweb.servlet.ConfigTestServlet


    driver
    com.mysql.cj.jdbc.Driver


    url
    jdbc:mysql://localhost:3306/bjpowernode


    user
    root


    password
    root1234


    以上标签中的是初始化参数。这个初始化参数信息会自动被小猫咪封装到ServletConfig对象当中。
    8. ServletConfig接口中有4个方法:
    第1个方法:
    public String getInitParameter(String name);
    第2个方法:

    1. public Enumeration<String> getInitParameterNames();<br /> 3个方法:<br /> public ServletContext getServletContext();<br /> 4个方法:<br /> public String getServletName();<br /> <br /> 以上的4个方法,在自己编写的Servlet类当中也可以使用this去调用。(这个Servlet继承了GenericServlet)<br />

    ServletConfig01
    image.png

    1. ** ServletConfig02**<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/22702196/1636802327641-54be5405-c0b9-4118-a196-ca375ffbe542.png#clientId=ud104e4de-6fb8-4&from=paste&height=434&id=ue89f9f12&margin=%5Bobject%20Object%5D&name=image.png&originHeight=868&originWidth=1462&originalType=binary&ratio=1&size=99103&status=done&style=none&taskId=u37b14428-831d-43c9-8046-288ce321645&width=731)
    2. ** web.xml**<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/22702196/1636802412414-2af414da-d3b5-4869-8d70-6c1ff7c9ac53.png#clientId=ud104e4de-6fb8-4&from=paste&height=820&id=u00444378&margin=%5Bobject%20Object%5D&name=image.png&originHeight=1639&originWidth=1279&originalType=binary&ratio=1&size=136684&status=done&style=none&taskId=uef25f048-a272-4a88-94ad-d988f43e822&width=639.5)
    3. [ServletConfig01.java](https://www.yuque.com/attachments/yuque/0/2021/java/22702196/1636802480182-640fd51a-7c55-4c60-b88d-71e225fe6bc0.java?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fjava%2F22702196%2F1636802480182-640fd51a-7c55-4c60-b88d-71e225fe6bc0.java%22%2C%22name%22%3A%22ServletConfig01.java%22%2C%22size%22%3A1112%2C%22type%22%3A%22%22%2C%22ext%22%3A%22java%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22uff165abf-8249-46fd-b26d-81a4068ba33%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22ued2bc931%22%2C%22card%22%3A%22file%22%7D)<br /> [ServletConfig02.java](https://www.yuque.com/attachments/yuque/0/2021/java/22702196/1636802488490-ce9f80ff-93c4-470d-bc0a-a48adfe7bb69.java?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fjava%2F22702196%2F1636802488490-ce9f80ff-93c4-470d-bc0a-a48adfe7bb69.java%22%2C%22name%22%3A%22ServletConfig02.java%22%2C%22size%22%3A869%2C%22type%22%3A%22%22%2C%22ext%22%3A%22java%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22u219fe53f-c60b-449b-b8c1-1019a9fe140%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22u22b955c3%22%2C%22card%22%3A%22file%22%7D) <br /> [web.xml](https://www.yuque.com/attachments/yuque/0/2021/xml/22702196/1636802505311-22567738-e0b4-4076-8b60-9cd4d5084096.xml?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fxml%2F22702196%2F1636802505311-22567738-e0b4-4076-8b60-9cd4d5084096.xml%22%2C%22name%22%3A%22web.xml%22%2C%22size%22%3A2861%2C%22type%22%3A%22text%2Fxml%22%2C%22ext%22%3A%22xml%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22u96248d16-d626-4f55-9cd8-ed45cdf02f8%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22u80a6dc57%22%2C%22card%22%3A%22file%22%7D)