Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study.

Similar presentations


Presentation on theme: "Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study."— Presentation transcript:

1 Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study

2 Objectives Introduction to Multi-tier Java Enterprise Applications. A Comprehensive Java Enterprise Application Example. Building and Deployment of Java Enterprise Application

3 Introduction Let us consider the following scenario for the project: A book distributor specializing in rare and hard to find books has hired us to create a website. The client wants a site that will allow bookstore owners to register, log in, browse the inventory of books, and place orders. The application must provide a way for a registered bookstore owner to view his previous orders. The shopping cart should allow a user to add books to the shopping cart, saving all of the selections made until the user is ready to complete the order. The bookstores should be able to include their distributor's inventory on their web pages if they want to, allowing the end customer to purchase a book online without knowing that it comes from the distributor.

4 Architecture Overview The MVC pattern will fit our project in the following ways: Model: JPA Entities representing real-world objects and concepts. Controller: Java Servlets will handle incoming requests and decide the flow of the application. Java session beans will implement the application's business logic. View: JSP pages will present a web interface for the user, gathering input and displaying output.

5 Architecture Overview, contd.

6 Enterprise Tier Our Enterprise Tier is made up of two separate but related components. We have session beans that implement the logic for the application and the JPA entities that make up the data model.

7 Session Beans The session beans will implement the application's logic, making up part of the Controller in our MVC architecture.

8 Web Tier The web tier makes up the View in our MVC architecture, but also crosses over into the Controller portion as well. The Servlets act as controllers by accepting and validating input, calling the appropriate session bean methods, and handing off the results of the processing to the View component (the JSP pages). The distinction between View and Controller in the web tier falls along the lines of separation between Servlet and JSP.

9 Servlets The main purpose of the Servlets in our application is to accept, validate, and parse the input from the user's web browser, call the appropriate session bean methods, and decide what the next step is. The Servlets in our application should never output HTML directly to the client because that would cross the line between Controller and View and would also cause us to have to use all sorts of strange looking escape sequences for outputting double quotes which, aside from looking hideous, are hard to type.

10 Building and Deploying NetBeans organizes the Enterprise Application project into three separate projects – an EJB project containing enterprise components, a web project containing web components, and an Enterprise project that depends on the other two and ties them together. To make things even more convenient, NetBeans will also allow us to build and deploy to the GlassFish application server.

11 Building and Deploying, contd. To deploy the application to a production server will require the uploading the Enterprise Archive (EAR) file to the application server through the management console. The EAR file is a special type of ZIP file that contains a Java Archive (JAR) file containing the EJB project components and the Web Archive (WAR) file containing the web components of the Enterprise project.

12 Chapter 9 The End


Download ppt "Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study."

Similar presentations


Ads by Google