TAILIEUCHUNG - The j2eetm tutorial - phần 6

BookDB nhập khẩu, nhập khẩu .*; nhập khẩu công cuối cùng lớp ContextListener thực hiện ServletContextListener {bối cảnh ServletContext tin = null; public void contextInitialized (ServletContextEvent sự kiện) | 176 JavaServer Pages Technology @ page errorPage file_name The Duke s Bookstore application page contains the directive @ page errorPage The beginning of indicates that it is serving as an error page with the following page directive @ page isErrorPage true false This directive makes the exception object of type available to the error page so that you can retrieve interpret and possibly display information about the cause of the exception in the error page. Note You can also define error pages for the WAR that contains a JSP page. If error pages are defined for both the WAR and a JSP page the JSP page s error page takes precedence. Initializing and Finalizing a JSP Page You can customize the initialization process to allow the JSP page to read persistent configuration data initialize resources and perform any other one-time activities by overriding the jspInit method of the JspPage interface. You release resources using the jspDestroy method. The methods are defined using JSP declarations discussed in Declarations page 182 . The bookstore example page defines the jspInit method to retrieve or create a JavaBeans component that represents the bookstore database private BookDB bookDB public void jspInit bookDB BookDB getServletContext . getAttribute bookDB if bookDB null try bookDB new BookDB getServletContext .setAttribute Initializing and Finalizing a JSP Page 177 bookDB bookDB catch Exception ex and the jspDestroy method to remove the JavaBeans component and release the BookDB variable. public void jspDestroy try catch Exception ex getServletContext .removeAttribute bookDB bookDB null The implementation of the database bean follows. The bean has two instance variables the current book and a reference to the database enterprise bean. The reference is created using the techniques .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.