javax.servlet.Servlet接口

< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd>


servlet抽象集是javax.servlet.Servlet接口,它规定了必须由Servlet类实现由servlet引擎识别和管理的方法集。
Servlet接口的基本目标是提供生命期方法init()、service()和destroy()方法。


servlet接口中的方法       
void init(ServletConfit config)throws ServletException     在servlet被载入后和实施服务前由servlet引擎进行?次性调用。如果init()产生溢出UnavailableException,则servle退出服务。       
ServletConfig getServletConfig()     返回传递到servlet的init()方法的ServletConfig对象       
void service(ServletRequest request, ServletResponse response)throws ServletException,IOException     处理request对象中描述的请求,使用response对象返回请求结果       
String getServletInfo()         返回描述servlet的一个字符串       
void destory()         当servlet将要卸载时由servlet引擎调用
原文地址:https://www.cnblogs.com/netcorner/p/2912413.html