Parameters:
req - the HttpServletRequest object that contains the request the client made of the servlet
resp - the HttpServletResponse object that contains the response the servlet returns to the client
Throws:
java.io.IOException - if an input or output error occurs while the servlet is handling the HTTP request
ServletException - if the HTTP request cannot be handled
1.GenericServlet的类结构
javax.servlet
Class GenericServlet
java.lang.Object
javax.servlet.GenericServlet
All Implemented Inteces:
java.io.Serializable, Servlet, ServletConfig
Direct Known Subclasses:
HttpServlet
2.GenericServlet的介绍
Defines a generic, protocol-independent servlet. To write an HTTP servlet for use on the Web, extend HttpServlet instead.
GenericServlet implements the Servlet and ServletConfig inteces. GenericServlet may be directly extended by a servlet, although it's more common to extend a protocol-specific subclass such as HttpServlet.
GenericServlet makes writing servlets easier. It provides versions of the lifecycle methods init and destroy and of the methods in the ServletConfig intece. GenericServlet also implements the log method, declared in the ServletContext intece.
To write a generic servlet, you need only override the abstract service method
3.GenericServlet的ap
1) java.lang.String getServletName()
Returns the name of this servlet instance获取servlet配置时,声明在web应用内部使用的名字。
2)java.util.Enumeration<java.lang.String> getInitParameterNames()
Returns the names of the servlet's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the servlet has no initialization parameters
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-36808-3.html
颗颗爱心变希望
别以为这是US的强大
企业要生存