tailieunhanh - Advanced Java 2 Platform HOW TO PROGRAM phần 7

Nếu không có giỏ mua hàng, JSP chỉ đơn giản là kết quả đầu ra một thông báo chỉ ra rằng hàng có sản phẩm nào. Nếu không, đường 34-41 tạo ra các biến được sử dụng để AddToCartServlet đặt một mục trong giỏ mua hàng và gọi để hiển thị các nội dung giỏ hàng (phần 2 of 2). | 1060 Enterprise Java Case Study Presentation and Controller Logic Chapter 18 Fig. LoginServlet for authenticating registered Customers part 4 of 4 . Images courtesy Pixo Inc. or 2001 Nokia Mobile Phones. LoginServlet uses the Customer EJB to validate the userID and password that the customer entered. Lines 39-44 obtain a reference to the CustomerHome interface. Lines 47-48 invoke CustomerHome method findByLogin which returns a remote reference to the Customer with the userID and password that the user provided. Once the Customer is found lines 59-69 build a simple XML document that indicates the customer has successfully logged into the store. Lines 74-82 catch a NamingException if the Customer EJB cannot be found in the JNDI directory. If no Customer is found that matches the userID and password the user entered lines 85-93 catch a FinderException. Each catch block builds an XML error message for the client to display. Lines 96-98 present the content to the client. ViewOrderHistoryServlet Registered customers may want to see information about orders they have placed in the past. ViewOrderHistoryServlet Fig. allows customers to see orders they have placed along with the dates the orders were taken the total costs of the orders and whether or not the orders were shipped from the warehouse. Chapter 18 Enterprise Java Case Study Presentation and Controller Logic 1061 1 2 ViewOrderHistoryServlet presents a list of previous Orders 3 to the Customer. 4 package 5 6 Java core packages 7 import . 8 import . 9 10 Java extension packages 11 import . 12 import . 13 import j . 14 import j . 15 import j . 16 17 third-party packages 18 import . 19 20 Deitel packages 21 import . 22 import . 23 import . 24

TỪ KHÓA LIÊN QUAN