Java Server Pages: A Code-Intensive Premium Reference- P22
Số trang: 10
Loại file: pdf
Dung lượng: 167.91 KB
Lượt xem: 19
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Java Server Pages: A Code-Intensive Premium Reference- P22:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basicstructure. This should help you outline your reading plan if you choose not to read the text from cover tocover. This introduction gives you an overview of what each chapter covers.
Nội dung trích xuất từ tài liệu:
Java Server Pages: A Code-Intensive Premium Reference- P22ClassesClasses for the javax.servlet package are GenericServlet, ServletInputStream, andServletOutputStream. Their methods are described in the following sections.GenericServlet ClassThe GenericServlet class was created to provide a basic foundation of new servlets. It provides defaultlife cycle methods and default implementations of the ServletConfigs methods.GenericServlet() Methodpublic GenericServlet()The GenericServlet() method is an empty default constructor. GenericServlet() has noparameters, returns no value, and throws no exceptions.destroy() Methodpublic void destroy()The destroy() method is executed when the servlet is removed from the running service. It performsany cleanup of resources that were allocated in the init() method. destroy() has no parameters,returns no value, and throws no exceptions.getInitParameter() Methodpublic java.lang.String getInitParameter( java.lang.String name)The getInitParameter() method returns a String containing the value of the initialization parameterkeyed by the passed in name. getInitParameter() throws no exceptions.Parameters java.lang.StringReturns java.lang.StringgetInitParameterNames() Methodpublic java.util.Enumeration getInitParameterNames()The getInitParameterNames() method returns an Enumeration containing all of the names foreach initialization parameter. getInitParameterNames() has no parameters and throws noexceptions.Returns java.util.EnumerationgetServletConfig() Methodpublic ServletConfig getServletConfig()The getServletConfig() method returns a ServletConfig object containing any startupconfiguration information for this servlet. getServletConfig() has no parameters and throws noexceptions.Returns ServletConfiggetServletContext() Methodpublic ServletContext getServletContext()The getServletContext() method returns a ServletContext object containing information aboutthe servlets network service. getServletContext() has no parameters and throws no exceptions.Returns ServletContext - 211 -getServletInfo() Methodpublic java.lang.String getServletInfo()The getServletInfo() method returns a String containing servlet-specific information about theimplementing servlet. getServletInfo() has no parameters and throws no exceptions.Returns java.lang.Stringinit(ServletConfig config) Methodpublic void init(ServletConfig config) throws ServletExceptionThe init() method marks the beginning of a servlets life. It is called only when the servlet is first loaded,and it must execute successfully before the servlet can service requests. The init() method shouldcontain all initialization code for the servlet. It returns no value.Parameters ServletConfig (encapsulates the servlets startup configuration and initialization parameters)Exceptions Thrown ServletExceptioninit() Methodpublic void init() throws ServletExceptionThis parameterless implementation of the init() method is provided only for convenience. It prevents aderived servlet from having to store the ServletConfig object. init() has no parameters and returnsno value.Exceptions Thrown ServletExceptionlog(java.lang.String message) Methodpublic void log(java.lang.String message)The log() method takes the passed in message and the name of the servlet and writes them to a log file.The location of the log is server specific. log() returns no value and throws no exceptions.Parameters java.lang.Stringlog(java.lang.String message, java.lang.Throwable t) Methodpublic void log(java.lang.String message, java.lang.Throwable t)This log() method takes the passed in message and Throwable object and logs the message with astack trace from the Throwable object. log() returns no value and throws no exceptions.Parameters java.lang.String java.lang.Throwableservice() Methodpublic void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOException - 212 -The service() method defines the servlets entry point for servicing requests. It can be executed onlyafter the servlets init() method has executed successfully. The service() method is the life cyclemethod executed for every incoming request. It returns no value.Parameters ServletRequest ServletResponseExceptions Thrown ServletException java.io.IOExceptionServletInputStream ClassThe ServletInputStream is an abstract class defined for servlet writers to get data from the client. It ismeant to be implemented by a network services writer. This class has two methods.ServletInputStream() Methodprotected ServletInputStream()The ServletInputStream() method is the empty default constructor. It has no parameters, returns novalue, and throws no exceptions.readLine() Methodpublic void readLine(byte[] b, int off, int len) throws java.io.IOExceptionThe readLine() method reads the len of bytes into the passed in byte array b, starting at position off.If the character \n is encountered, then no more bytes are read in. readLine() returns no value.Parameters byte[] int intExceptions Thrown java.io.IOExceptionServletOutputStream ClassThe ServletOutputStream class is used to write responses back to the client. It is an abstract classthat is implemented by the network services implementor. To access the ServletOutputStream, youmust call the ServletResponses getOutputStream() method. The class has several methods.ServletOutputStream() Methodpublic ServletOutputStream() throws java.io.IOExceptionThe ServletOutputStream() method is the empty default constructor. It has no parameters andreturns no value.Exc ...
Nội dung trích xuất từ tài liệu:
Java Server Pages: A Code-Intensive Premium Reference- P22ClassesClasses for the javax.servlet package are GenericServlet, ServletInputStream, andServletOutputStream. Their methods are described in the following sections.GenericServlet ClassThe GenericServlet class was created to provide a basic foundation of new servlets. It provides defaultlife cycle methods and default implementations of the ServletConfigs methods.GenericServlet() Methodpublic GenericServlet()The GenericServlet() method is an empty default constructor. GenericServlet() has noparameters, returns no value, and throws no exceptions.destroy() Methodpublic void destroy()The destroy() method is executed when the servlet is removed from the running service. It performsany cleanup of resources that were allocated in the init() method. destroy() has no parameters,returns no value, and throws no exceptions.getInitParameter() Methodpublic java.lang.String getInitParameter( java.lang.String name)The getInitParameter() method returns a String containing the value of the initialization parameterkeyed by the passed in name. getInitParameter() throws no exceptions.Parameters java.lang.StringReturns java.lang.StringgetInitParameterNames() Methodpublic java.util.Enumeration getInitParameterNames()The getInitParameterNames() method returns an Enumeration containing all of the names foreach initialization parameter. getInitParameterNames() has no parameters and throws noexceptions.Returns java.util.EnumerationgetServletConfig() Methodpublic ServletConfig getServletConfig()The getServletConfig() method returns a ServletConfig object containing any startupconfiguration information for this servlet. getServletConfig() has no parameters and throws noexceptions.Returns ServletConfiggetServletContext() Methodpublic ServletContext getServletContext()The getServletContext() method returns a ServletContext object containing information aboutthe servlets network service. getServletContext() has no parameters and throws no exceptions.Returns ServletContext - 211 -getServletInfo() Methodpublic java.lang.String getServletInfo()The getServletInfo() method returns a String containing servlet-specific information about theimplementing servlet. getServletInfo() has no parameters and throws no exceptions.Returns java.lang.Stringinit(ServletConfig config) Methodpublic void init(ServletConfig config) throws ServletExceptionThe init() method marks the beginning of a servlets life. It is called only when the servlet is first loaded,and it must execute successfully before the servlet can service requests. The init() method shouldcontain all initialization code for the servlet. It returns no value.Parameters ServletConfig (encapsulates the servlets startup configuration and initialization parameters)Exceptions Thrown ServletExceptioninit() Methodpublic void init() throws ServletExceptionThis parameterless implementation of the init() method is provided only for convenience. It prevents aderived servlet from having to store the ServletConfig object. init() has no parameters and returnsno value.Exceptions Thrown ServletExceptionlog(java.lang.String message) Methodpublic void log(java.lang.String message)The log() method takes the passed in message and the name of the servlet and writes them to a log file.The location of the log is server specific. log() returns no value and throws no exceptions.Parameters java.lang.Stringlog(java.lang.String message, java.lang.Throwable t) Methodpublic void log(java.lang.String message, java.lang.Throwable t)This log() method takes the passed in message and Throwable object and logs the message with astack trace from the Throwable object. log() returns no value and throws no exceptions.Parameters java.lang.String java.lang.Throwableservice() Methodpublic void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOException - 212 -The service() method defines the servlets entry point for servicing requests. It can be executed onlyafter the servlets init() method has executed successfully. The service() method is the life cyclemethod executed for every incoming request. It returns no value.Parameters ServletRequest ServletResponseExceptions Thrown ServletException java.io.IOExceptionServletInputStream ClassThe ServletInputStream is an abstract class defined for servlet writers to get data from the client. It ismeant to be implemented by a network services writer. This class has two methods.ServletInputStream() Methodprotected ServletInputStream()The ServletInputStream() method is the empty default constructor. It has no parameters, returns novalue, and throws no exceptions.readLine() Methodpublic void readLine(byte[] b, int off, int len) throws java.io.IOExceptionThe readLine() method reads the len of bytes into the passed in byte array b, starting at position off.If the character \n is encountered, then no more bytes are read in. readLine() returns no value.Parameters byte[] int intExceptions Thrown java.io.IOExceptionServletOutputStream ClassThe ServletOutputStream class is used to write responses back to the client. It is an abstract classthat is implemented by the network services implementor. To access the ServletOutputStream, youmust call the ServletResponses getOutputStream() method. The class has several methods.ServletOutputStream() Methodpublic ServletOutputStream() throws java.io.IOExceptionThe ServletOutputStream() method is the empty default constructor. It has no parameters andreturns no value.Exc ...
Tìm kiếm theo từ khóa liên quan:
nhập môn lập trình kỹ thuật lập trình lập trình flash lập trình web ngôn ngữ html lập trình hướng đối tượngTài liệu có liên quan:
-
Đề cương chi tiết học phần Cấu trúc dữ liệu và giải thuật (Data structures and algorithms)
10 trang 359 0 0 -
Giáo trình Lập trình hướng đối tượng: Phần 2
154 trang 315 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 309 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 247 0 0 -
Giới thiệu môn học Ngôn ngữ lập trình C++
5 trang 222 0 0 -
101 trang 211 1 0
-
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 188 0 0 -
Luận văn tốt nghiệp Công nghệ thông tin: Xây dựng website bán hàng nông sản
67 trang 178 0 0 -
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 159 0 0 -
Giáo trình nhập môn lập trình - Phần 22
48 trang 143 0 0