1 / 26

Web Technology and DBMS

Web Technology and DBMS. Fall 2005 CS 8630 Section 01: Database Administration – Dr. Mario Guimaraes Final Project - Submission Date: 12/14/2005 Michael Graham. The Card Inventory Application. Motivations: Real world application It is all new Most of the technology is free.

bruno
Download Presentation

Web Technology and DBMS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Technology and DBMS Fall 2005 CS 8630 Section 01: Database Administration – Dr. Mario Guimaraes Final Project - Submission Date: 12/14/2005 Michael Graham The Card Inventory Application

  2. Motivations: Real world application It is all new Most of the technology is free. Java Servlets. WordPad Apache Tomcat MySQL Overview

  3. The client has requested an add-on application to allow its customers to add their cards to a Web based inventory application specialized in hobby-card sales. Goal is to create a small Web based application used to store the customer’s card inventory. Customers will be able to buy and sell any and all cards in the inventory. Customers can build a list of purchases (shopping cart). Once a customer’s order is confirmed the purchase is final and any cards are automatically removed from the seller(s) inventory and into the customer inventory. The customer can then make any changes to their card inventory. Introduction

  4. Visual

  5. ER Diagram

  6. Tables

  7. Forms

  8. The servlet engine for this project use Tomcat 5.028 and Apache Web server 2.052. Java Servlets basically define as server side Java programs that are used in place of CGI scripts. Java servlets allow for creating dynamic HTML and so the presentation of a web page can be created or changed based on the data results. The servlet engine Provides: Runtime environment for servlet execution Manages the life-cycle of servlets from when they are first created through their destruction Provides the servlet API for developers to use. (Compile needs classpath: c:\tomcat\common\lib\servlet-api.jar) Connection to MySQL requires a JDBC driver. Specified in classpath on the Java Servlet compiler: c:\tomcat\common\lib\mysql-connector-java-3.0.16-bin.jar Over View

  9. 1. Create new directory structures under Tomcat for the application package (c:\tomcat\webapps\WebBBapp) -> create WebBBapp directory (c:\tomcat\webapps\WebBBapp\WEB-INF) -> create WEB-INF (c:\tomcat\webapps\WebBBapp\WEB-INF\ classes\) -> create classes (c:\tomcat\webapps\WebBBapp\WEB-INF\ classes\BBapp\ \) -> create BBapp 2 In Tomcat a deployment descriptor needs to be created. This is am XML document called web.xml and must be located in the WEB-INF directory under BBapp. (c:\tomcat\webapp\WebBBapp\WEB-INF\web.xml) <web-app> <servlet> <servlet-name>GetCardServlet</servlet-name> <servlet-class>BBapp.GetCardServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>GetCardServlet</servlet-name> <url-pattern>/servlet/GetCardServlet</url-pattern> </servlet-mapping> Over View

  10. package BBapp; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class GetCardServlet extends HttpServlet { public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { String sql1; sql1 = null; String ICust; String Iaction; String Icardid; try { ICust = request.getParameter("custloginID") ; Iaction = request.getParameter("dbaction") ; Icardid = request.getParameter("cardid") ; Class.forName("com.mysql.jdbc.Driver"); // Set up the Db Driver for MYSQL // Set up the Connect to db using a userid and password String dbinfo = "jdbc:mysql:///baseball?user=root&password=password"; //Connect to the database.. Connection conn = DriverManager.getConnection(dbinfo); response.setContentType("text/html"); PrintWriter out1 = response.getWriter(); // Create and Execute SQL, get recordset Statement stmt = conn.createStatement(); sql1 = "SELECT * from cards where CardID='"+ Icardid + "' " ; ResultSet RS = stmt.executeQuery(sql1); Code

  11. Login

  12. New Account

  13. baseballMain.html

  14. ByCard - cardServlet

  15. Submit - OrderServlet

  16. Confirm - AddOrderServlet

  17. Show My Inventory

  18. ViewCard 7 in list-GetCard

  19. Update image location- AddCardservlet

  20. Delete Card 7- AddCardservlet

  21. Card Purchased by other user so not in our inventory Card Purchased by user “rguy”, but the order was not confirmed

  22. Different customer “rguy” getOrder Card 8 Purchased by user “rguy”, but the order was not confirmed

  23. Confirmation - AddOrderServlet Customer “rguy” viewing his cart. Confirms purchase of card 8

  24. Card Purchased by other user so not in our inventory Card ownership changed. Card 8 belongs to “rguy”

  25. Inventory Display for “rguy” Card ownership changed. Card 8 belongs to “rguy”

  26. Difficulties: HTML! Parameter Passing, JavaScript. jGrasp Crashes. Things done differently: Plan for more time. Used Oracle. Further enhancements: Make the shopping cart editable. Ability to cancel/delete orders. Display orders improved. Searches by other criteria. Better looking web pages. End

More Related