关于GenericServlet和HttpServlet

来源:互联网 发布:linux 下载wget安装包 编辑:程序博客网 时间:2024/06/04 17:49

GenericServlet:它实现了两接口Servlet和ServletConfig.它实现了Servlet接口中除service()方法外的其他4个方法。To writea generic servlet, you need only override the abstract service method.

HttpServlet:它继承自GenericServletA subclass ofHttpServlet must override at least one method, usually one of these:

·       doGet, if the servletsupports HTTP GET requests

·       doPost, for HTTP POSTrequests

·       doPut, for HTTP PUTrequests

·       doDelete, for HTTPDELETE requests

·       init and destroy, to manageresources that are held for the life of the servlet

·       getServletInfo, whichthe servlet uses to provide information about itself

       service handles standard HTTP requests bydispatching them to the handler methods for each HTTP request type (the doXXXmethods listed above).

原创粉丝点击