Servlet接口定义了五个方法
1.void init(ServletConfig config) throws ServletException
当Servlet第一次被请求时,Servlet容器会调用这个方法,之后不会再调用
2. void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOException
除了第一次被请求时同时调用init()和dervice两个方法外,其余每次请求都只是调用service方法
3. void destroy()
销毁servlet对象时调用
4. java.lang.String getServletInfo()
返回servlet描述
5. ServletConfig getServletConfig()
返回由Servlet容器传给init方法的ServletConfig
原文:https://www.cnblogs.com/jiangfeilong/p/10640120.html