分享
 
 
 

javax.servlet.Servlet翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

[/url] [url=file:///F:/资料/文字资料/j2ee-1.4_doc/apidocs/overview-summary.html]Overview

Package

Class

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Ent. Ed. v1.4

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

javax.servlet

Interface ServletAll Known Subinterfaces: HttpJspPage, JspPage All Known Implementing Classes: GenericServlet public interface ServletDefines methods that all servlets must implement. 定义所有Servlets必须实现的方法。

A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the HyperText Transfer Protocol. servlet是运行在web服务器上的Java小程序,Servlets通常通过HTTP(超文本传输协议)接收并响应web客户端的请求,

To implement this interface, you can write a generic servlet that extends javax.servlet.GenericServlet or an HTTP servlet that extends javax.servlet.http.HttpServlet. 为了实现这个接口,你可以继承javax.servlet.GenericServlet类或者继承javax.servlet.http.HttpServlet类。

This interface defines methods to initialize a servlet, to service requests, and to remove a servlet from the server. These are known as life-cycle methods and are called in the following sequence: 该接口定义了方法来初始化servlet,处理请求,和删除服务器上的servlet。 这些生命周期的方法按以下顺序调用。

The servlet is constructed, then initialized with the init method. 构造servlet,然后init方法初始化。 Any calls from clients to the service method are handled. 处理客户端对service方法的任何调用。 The servlet is taken out of service, then destroyed with the destroy method, then garbage collected and finalized. servlet从服务中取出,然后destory方法清除,接着垃圾收集和终止。 In addition to the life-cycle methods, this interface provides the getServletConfig method, which the servlet can use to get any startup information, and the getServletInfo method, which allows the servlet to return basic information about itself, such as author, version, and copyright. 除了这些生命周期方法之外,该接口还提供了getServletConfig方法,servlet用来获取启动信息, getServletInfo方法,允许servlet返回它自身的基本信息,比如作者、版本和版权。

Version: $Version$ Author: Various See Also: GenericServlet, HttpServletMethod Summary

void

destroy()

Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. 由servlet容器调用,表示servlet正被服务清除。

ServletConfig

getServletConfig()

Returns a ServletConfig object, which contains initialization and startup parameters for this servlet.返回ServletConfig对象,包含该servlet的启动参数。

String

getServletInfo()

Returns information about the servlet, such as author, version, and copyright. 返回servlet的信息,例如作者、版本和版权。

void

init(ServletConfig config)

Called by the servlet container to indicate to a servlet that the servlet is being placed into service.由servlet容器调用,表示servlet正被放入服务。

void

service(ServletRequest req, ServletResponse res)

Called by the servlet container to allow the servlet to respond to a request.由servlet容器调用,允许servlet响应请求。

Method Detail

initpublic void init(ServletConfig config)

throws ServletException

Called by the servlet container to indicate to a servlet that the servlet is being placed into service. 由servlet容器调用,表示servlet正被放入服务。 The servlet container calls the init method exactly once after instantiating the servlet. The init method must complete successfully before the servlet can receive any requests. 在初始化servlet之后,实际上servlet容器仅调用init方法一次。init方法在servlet能接收请求之前必须成功执行。

The servlet container cannot place the servlet into service if the init method 如果init方法有以下情况出现,servlet容器将不能把servlet放入服务。

Throws a ServletException 抛出ServletException Does not return within a time period defined by the Web server 在Web服务器定义的时间周期内不能返回

Parameters: config - a ServletConfig object containing the servlet's configuration and initialization parameters ServletConfig对象,包含servlet配置和初始化参数 Throws: ServletException - if an exception has occurred that interferes with the servlet's normal operation 如果servlet的正常操作中发生异常时抛出 See Also: UnavailableException, getServletConfig()getServletConfigpublic ServletConfig getServletConfig()

Returns a ServletConfig object, which contains initialization and startup parameters for this servlet. The ServletConfig object returned is the one passed to the init method. 返回ServletConfig对象,包含该servlet的启动参数。返回的ServletConfig对象传递给init方法。 Implementations of this interface are responsible for storing the ServletConfig object so that this method can return it. The GenericServlet class, which implements this interface, already does this. 实现了该接口可以对ServletConfig进行保存,因为该方法能够返回它。GenericServlet类实现了该接口,已经可以完成此任务。

Returns: the ServletConfig object that initializes this servlet 初始化servlet的ServletConfig对象 See Also: init(javax.servlet.ServletConfig)servicepublic void service(ServletRequest req,

ServletResponse res)

throws ServletException,

IOException

Called by the servlet container to allow the servlet to respond to a request. 由servlet容器调用,允许servlet响应请求。 This method is only called after the servlet's init() method has completed successfully. 在servlet的init方法成功执行之后该方法仅被调用一次。

The status code of the response always should be set for a servlet that throws or sends an error. 响应状态码应该始终设置给servlet,用于抛出或发送错误。

Servlets typically run inside multithreaded servlet containers that can handle multiple requests concurrently. Developers must be aware to synchronize access to any shared resources such as files, network connections, and as well as the servlet's class and instance variables. More information on multithreaded programming in Java is available in the Java tutorial on multi-threaded programming. servlet通常运行在多线程的servlet容器内部,可以并发处理多请求。开发人员 必须意识到对于任何共享资源,例如文件、网络连接,包括servlet的类和实例变量,进行同步访问。

Parameters: req - the ServletRequest object that contains the client's request 包含客户端请求的ServletRequest对象 res - the ServletResponse object that contains the servlet's response 包含servlet响应的ServletResponse对象 Throws: ServletException - if an exception occurs that interferes with the servlet's normal operation 如果妨碍servlet正常工作的异常发生时抛出 IOException - if an input or output exception occurs 如果输入输出异常发生时抛出getServletInfopublic String getServletInfo()

Returns information about the servlet, such as author, version, and copyright. 返回servlet的信息,例如作者、版本和版权。 The string that this method returns should be plain text and not markup of any kind (such as HTML, XML, etc.). 该方法返回的字符串应当是纯文本,不含HTML、XML等标记符。

Returns: a String containing servlet information 包含servlet信息的字符串destroypublic void destroy()

Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. This method is only called once all threads within the servlet's service method have exited or after a timeout period has passed. After the servlet container calls this method, it will not call the service method again on this servlet. 由servlet容器调用,表示servlet正被服务清除。该方法只在servlet的service方法退出或者超时被所有线程调用一次。 servlet容器调用该方法后,servlet不会再次调用service方法。 This method gives the servlet an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the servlet's current state in memory. 该方法使得servlet有机会清除持有的所有资源(例如内存、文件处理、线程),确保任何持久化状态与内存中servlet的当前状态一致。

[/url][url=file:///F:/资料/文字资料/j2ee-1.4_doc/apidocs/overview-summary.html]Overview

Package

Class

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Ent. Ed. v1.4

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature Copyright 2003 Sun Microsystems, Inc. All rights reserved.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有