Java Server Pages: A Code-Intensive Premium Reference- P7

Java Server Pages: A Code-Intensive Premium Reference- P7:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | BODY HTML Note A key thing to note is the HTML code that is intermingled throughout the scriptlet code. This is done by closing the scriptlet block with the symbol inserting the HTML code and then reopening the scriptlet block with the symbol. As you look through the generated listing examine how this is implemented in the _jspService method. There is really nothing special about the JSP presented in Listing . You are simply taking a basic JDBC query and embedding into a JSP scriptlet. When this JSP is first requested it is compiled into a servlet and the scriptlet code containing the query is placed into the generated _jspService method. A code snippet follows containing the generated method with small changes for readability public void _jspService HttpServletRequest request HttpServletResponse response throws lOException ServletException JspFactory _jspxFactory null PageContext pageContext null HttpSession session null ServletContext application null ServletConfig config null JspWriter out null Object page this String _value null try if _jspx_inited false jspx_init jspx_inited true jspxFactory text html pageContext this request response true 8192 true application - 61 - config session out begin HTML r n HEAD r n TITLE JSP JDBC Example 1 TITLE r n HEAD r n r n BODY r n r n -- Set the scripting language to java and -- r n -- import the package -- r n end begin r n r n end begin file D from 11 2 to 33 6 Connection con null try Load the Driver class file Make a connection to the ODBC datasource con jdbc odbc Movie Catalog Create the statement Statement statement Use the created statement to SELECT the DATA FROM the Titles Table. ResultSet rs .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.