设为首页收藏本站

嘻皮客娱乐学习网

 找回密码
 中文注册
搜索
打印 上一主题 下一主题
开启左侧

[面试题库] 介绍一下javax.servlet.Servlet接口及其主要方法

[复制链接]
跳转到指定楼层
楼主
发表于 2014-11-30 17:03:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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引擎调用,销毁Servlet实例。
回复

使用道具 举报

小黑屋|手机版|嘻皮客网 ( 京ICP备10218169号|京公网安备11010802013797  

GMT+8, 2024-5-5 08:49 , Processed in 0.186232 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表