Presentation is loading. Please wait.

Presentation is loading. Please wait.

 2002 Prentice Hall. All rights reserved. Chapter 17: Enterprise Java Case Study: Architectural Overview Outline 17.1 Introduction 17.2 Deitel Bookstore.

Similar presentations


Presentation on theme: " 2002 Prentice Hall. All rights reserved. Chapter 17: Enterprise Java Case Study: Architectural Overview Outline 17.1 Introduction 17.2 Deitel Bookstore."— Presentation transcript:

1  2002 Prentice Hall. All rights reserved. Chapter 17: Enterprise Java Case Study: Architectural Overview Outline 17.1 Introduction 17.2 Deitel Bookstore 17.3 System Architecture 17.4 Enterprise JavaBeans 17.4.1 Entity EJBs 17.4.2 Stateful Session EJBs 17.5 Servlet Controller Logic 17.6 XSLT Presentation Logic

2  2002 Prentice Hall. All rights reserved. 17.1 Introduction Online bookstore e-business application –Servlets –EJBs –XML –XSLT –MVC architecture

3  2002 Prentice Hall. All rights reserved. 17.2 Deitel Bookstore Case study –Implement functionality for commercial on-line store Provide product catalog Provide shopping cart Provide customer registration Allow customers to view previous orders Provide functionality for several clients –Standard Web browsers –WML browsers –cHTML browsers

4  2002 Prentice Hall. All rights reserved. 17.3 System Architecture Multi-tier application –Information tier Maintains data for application (RDBMS) –Middle tier Implements business logic and controller logic –Control interactions between information and client tiers –Client tier Application’s user interface (e.g., Web browser)

5  2002 Prentice Hall. All rights reserved. 17.3 System Architecture (cont.) Fig. 17.1Three-tier application model in Deitel Bookstore.

6  2002 Prentice Hall. All rights reserved. 17.3 System Architecture (cont.) Fig. 17.2Detailed architecture of Deitel Bookstore Enterprise Java case study.

7  2002 Prentice Hall. All rights reserved. 17.4 Enterprise JavaBeans EJBs –Implement business logic and database abstraction layer –Stateful session EJB Represents a customer’s shopping cart –Entity EJB Provide object-based interface to information tier Servlets –Use EJB business logic to create an on-line store

8  2002 Prentice Hall. All rights reserved. 17.4.1 Entity EJBs Entity EJB –Provide object-based interface to information tier –Represents object stored in application’s relational database Class Customer stores –First name –Last name –Billing address –Shipping address –Credit-card information Class Product

9  2002 Prentice Hall. All rights reserved. 17.4.1 Entity EJBs (cont.) Entity EJB –Each entity EJB has corresponding model class Has properties for each entity EJB property e.g., Product EJB has corresponding ProductModel –ProductModel has properties for Product ISBN Product price Product author

10  2002 Prentice Hall. All rights reserved. 17.4.2 Stateful Session EJBs ShoppingCart –Stateful session EJB –Manages customer’s shopping cart –Primary business-logic component in Deitel Bookstore

11  2002 Prentice Hall. All rights reserved. 17.5 Servlet Controller Logic Servlets –Middle-tier interface between client and business logic –Implement the controller in MVC architecture –Interact with EJB business-logic components Handle client requests (via HTTP and WAP) Process data as XML documents Pass XML documents through XSL transformations –Produce presentation for each client

12  2002 Prentice Hall. All rights reserved. 17.6 XSLT Presentation Logic Generate appropriate presentation for each client –Each servlet employs XSL Transformer and XSLTs One XLST for producing XHTML One XLST for producing WML One XLST for producing cHTML

13  2002 Prentice Hall. All rights reserved. Outline Fig. 17.3 XML file generated by Get- ProductServlet. Lines 1-14 1 2 3 4 0130284173 5 Prentice Hall 6 Deitel, Deitel, Nieto, Lin & Sadhu 7 XML How to Program 8 $69.95 9 1200 10 images/xmlhtp1.jpg 11 CD 12 500 13 14 XML document marks up a product, including the product’s ISBN, title, author, publisher and price

14  2002 Prentice Hall. All rights reserved. Outline Fig. 17.4 XSL transformation for generating XHTML from GetProduct- Servlet (part 1). Lines 1-92 1 2 3 4 5 6 7 <xsl:stylesheet version = "1.0" 8 xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> 9 10 <xsl:output method = "xml" omit-xml-declaration = "no" 11 indent = "yes" doctype-system = "DTD/xhtml1-strict.dtd" 12 doctype-public = "-//W3C//DTD XHTML 1.0 Strict//EN"/> 13 14 15 16 17 18 19 <html xmlns = "http://www.w3.org/1999/xhtml" 20 xml:lang = "en" lang = "en"> 21 22 23 24 -- Description 25 26 27 28 29 30 31 32 33 <xsl:for-each select = 34 "document( '/XSLT/XHTML/navigation.xml' )"> 35 Extract relevant pieces of information from the XML document to create appropriate XHTML representation

15  2002 Prentice Hall. All rights reserved. Outline Fig. 17.4 XSL transformation for generating XHTML from GetProduct- Servlet (part 2). 36 37 38 39 40 41 42 43 by 44 45 46 47 48 49 50 51 <img class = "bookCover" 52 src = "images/{image}" 53 alt = "{title} cover image."/> 54 55 56 57 58 Price: 59 60 61 62 ISBN: 63 64 65 66 Pages: 67 68

16  2002 Prentice Hall. All rights reserved. Outline Fig. 17.4 XSL transformation for generating XHTML from GetProduct- Servlet (part 3). 69 70 Publisher: 71 72 73 74 75 76 77 <input type = "submit" 78 value = "Add to cart"/> 79 80 <input type = "hidden" name = "ISBN" 81 value = "{ISBN}"/> 82 83 84 85 86 87 88 89 90 91 92

17  2002 Prentice Hall. All rights reserved. Outline Fig. 17.5 XHTML document generated by XSLT in Get- ProductServlet (part 1). 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 "DTD/xhtml1-strict.dtd"> 4 <html xmlns="http://www.w3.org/1999/xhtml" 5 lang="en" xml:lang="en"> 6 7 XML How to Program -- Description 8 9 10 11 12 13 14 15 16 <img src="images/logotiny.gif" 17 alt="Deitel & Associates, Inc. logo." /> 18 19 20 21 <div style= 22 "position: relative; bottom: -50px;"> 23 24 <input type="text" size="15" 25 name="searchString" /> 26 27 28 29 30 31 32 33 34

18  2002 Prentice Hall. All rights reserved. Outline Fig. 17.5 XHTML document generated by XSLT in Get- ProductServlet (part 2). 35 36 37 38 39 Product Catalog 40 41 42 43 Create Account 44 45 46 47 Log in 48 49 50 51 Shopping Cart 52 53 54 55 Order History 56 57 58 59 60 61 62 XML How to Program 63 64 by Deitel, Deitel, Nieto, Lin & Sadhu 65 66 67 68

19  2002 Prentice Hall. All rights reserved. Outline Fig. 17.5 XHTML document generated by XSLT in Get- ProductServlet (part 3). 69 <img alt="XML How to Program cover image." 70 src="images/xmlhtp1.jpg" 71 class="bookCover" /> 72 73 74 Price: $69.95 75 76 ISBN: 0130284173 77 78 Pages: 1100 79 80 Publisher: Prentice Hall 81 82 83 84 <input value="Add to cart" 85 type="submit" /> 86 <input value="0130284173" 87 name="ISBN" type="hidden" /> 88 89 90 91 92 93 94

20  2002 Prentice Hall. All rights reserved. Outline Fig. 17.5 XHTML document generated by XSLT in Get- ProductServlet (part 4).

21  2002 Prentice Hall. All rights reserved. Outline Fig. 17.6 XSL transformation for generating WML from GetProduct- Servlet (part 1). Lines 1-54 1 2 3 <xsl:stylesheet version = "1.0" 4 xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> 5 6 <xsl:output method = "xml" omit-xml-declaration = "no" 7 doctype-system = "http://www.wapforum.org/DTD/wml_1.1.xml" 8 doctype-public = "-//WAPFORUM//DTD WML 1.1//EN"/> 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Description: 27 28 by 29 30 31 32 33 ISBN: 34 35 Extract relevant pieces of information from the XML document to create appropriate WML representation

22  2002 Prentice Hall. All rights reserved. Outline Fig. 17.6 XSL transformation for generating WML from GetProduct- Servlet (part 2). 36 Price: 37 $ 38 39 40 41 Publisher: 42 43 44 Pages: 45 46 47 48 49 50 51 52 53 54

23  2002 Prentice Hall. All rights reserved. Outline Fig. 17.7 WML document generated by XSLT in Get- ProductServlet (part 1). Lines 1-29 1 2 <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" 3 "http://www.wapforum.org/DTD/wml_1.1.xml"> 4 5 6 7 8 9 10 11 12 13 Description: 14 XML How to Program 15 by Deitel, Deitel, Nieto, Lin & Sadhu 16 17 18 19 ISBN: 0130284173 20 Price: $$69.95 21 22 23 Publisher: Prentice Hall 24 Pages: 1100 25 26 27 28 29 WML document contains little formatting information, because display capabilities are limited

24  2002 Prentice Hall. All rights reserved. Outline Fig. 17.7 WML document generated by XSLT in Get- ProductServlet (part 2).

25  2002 Prentice Hall. All rights reserved. Outline Fig. 17.8 XSL transformation for generating cHTML from GetProduct- Servlet (part 1). Lines 1-78 1 2 3 <xsl:stylesheet version = "1.0" 4 xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> 5 6 <xsl:output method = "html" 7 omit-xml-declaration = "yes" 8 indent = "yes" 9 doctype-system = 10 "http://www.w3.org/MarkUp/html-spec/html-spec_toc.html" 11 doctype-public = "-//W3C//DTD HTML 2.0//EN"/> 12 13 14 15 16 17 18 19 20 -- Description 21 22 23 24 25 26 27 28 29 30 by 31 32 Extract relevant pieces of information from the XML document to create appropriate cHTML representation

26  2002 Prentice Hall. All rights reserved. Outline Fig. 17.8 XSL transformation for generating cHTML from GetProduct- Servlet (part 2). 33 34 35 36 37 38 <img class = "bookCover" 39 src = "images/{image}"/> 40 41 42 43 44 Price: 45 46 47 48 ISBN: 49 50 51 52 Pages: 53 54 55 56 Publisher: 57 58 59 60 61 62 63 <input type = "submit" 64 value = "Add to cart"/> 65 66

27  2002 Prentice Hall. All rights reserved. Outline Fig. 17.8 XSL transformation for generating cHTML from GetProduct- Servlet (part 3). 67 <input type = "hidden" name = "ISBN" 68 value = "{ISBN}"/> 69 70 71 72 73 74 75 76 77 78

28  2002 Prentice Hall. All rights reserved. Outline Fig. 17.9 cHTML document generated by XSLT in Get- ProductServlet (part 1). 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN" 2 "http://www.w3.org/MarkUp/html-spec/html-spec_toc.html"> 3 4 5 <META http-equiv="Content-Type" 6 content="text/html; charset=UTF-8"> 7 XML How to Program -- Description 8 9 10 XML How to Program 11 12 by Deitel, Deitel, Nieto, Lin & Sadhu 13 14 15 16 17 18 19 20 Price: $69.95 21 22 ISBN: 0130284173 23 24 Pages: 1100 25 26 27 Publisher: Prentice Hall 28 29 30 31 32 33 <input value="0130284173" name="ISBN" 34 type="hidden"> 35

29  2002 Prentice Hall. All rights reserved. Outline Fig. 17.9 cHTML document generated by XSLT in Get- ProductServlet (part 2). 36 37 38 39 40 41


Download ppt " 2002 Prentice Hall. All rights reserved. Chapter 17: Enterprise Java Case Study: Architectural Overview Outline 17.1 Introduction 17.2 Deitel Bookstore."

Similar presentations


Ads by Google