ONLINE SHOPPING CART full report
Mca Documentation.doc (Size: 3.54 MB / Downloads: 1742)
1.1. Project Description
E-commerce is fast gaining ground as an accepted and used business paradigm. More and more business houses are implementing web sites providing functionality for performing commercial transactions over the web. It is reasonable to say that the process of shopping on the web is becoming commonplace.
The objective of this project is to develop a general purpose e-commerce store where any product (such as books, CDs, computers, mobile phones, electronic items, and home appliances) can be bought from the comfort of home through the Internet.
However, for implementation purposes, this paper will deal with an online book store.
An online store is a virtual store on the Internet where customers can browse the catalog and select products of interest. The selected items may be collected in a shopping cart. At checkout time, the items in the shopping cart will be presented as an order. At that time, more information will be needed to complete the transaction. Usually, the customer will be asked to fill or select a billing address, a shipping address, a shipping option, and payment information such as credit card number. An e- mail notification is sent to the customer as soon as the order is placed.
1.2. Technologies Used
1.2.1. Java Server Pages (JSP)
With the advent of Internet, the monolithic application architecture changed to the multi-tiered client/server architecture. The need for server-side scripting gradually began to dominate aspects of Web Programming. Microsoft introduced Active Server Pages (ASP) to capture the market demand for server-side scripting. Working on similar lines, Sun Microsystems released Java Server Pages (JSP) to add server side programming functionalities to Java.
A typical web application consists of the presentation logic representing the static content used to design the structure of a web page in terms of the page layout, color, and text. The business logic or the dynamic content involves application of business intelligence and diagnostics in terms of financial and business calculations. When developing web applications, time is often lost in situations where the developer is required to code for the static content.
JSP Technology has facilitated the segregation of work profiles of a web designer and a web developer. A Web Designer can design and formulate the layout for the web page by using HTML. On the other hand, a Web Developer working independently can use Java code and other JSP specific tags to code for the business logic. The simultaneous construction of static and dynamic content facilitates development of quality applications with increased productivity.
The JSP Request-Response Cycle:
JSP files are stored on the web server with an extension of .jsp. When the client/browser requests for a particular JSP page, the server in turn sends a request to the JSP Engine.
The following figure represents the process of the flow of events that occur after a client requests for a JSP page.
The Request-Response Cycle for a JSP Page
The request-response cycle essentially comprises of two phases, namely the translation phase and request-processing phase. The translation phase is implemented by the JSP engine and involves generation of a servlet. Internally, these results in the creation of a class file for the JSP page that implements the servlet interface. During the request-processing phase, the response is generated according to the request specification. The servlet then sends back a response corresponding to the request received. After the servlet is loaded for the first time, it remains active and possesses all the subsequent requests with responses, saving time that would otherwise be lost in reloading a servlet at each request.
JDBC (Java Database Connectivity) is an application program interface (API) specification for connecting programs written in Java to the data in popular database. It is provided by Sun Microsystems, the application program interface lets you encode access request statements in structured query language (SQL) that are then passed to the program that manages the database. It returns the results through a similar interface.
From the user’s point of view, Java application looks something like this:
Features of JDBC API:
Java Database Connectivity (JDBC) provides a database programming API for Java programs. Some of the features of JDBC API are as follows:
• Contains a set of classes and interfaces that are used to connect to a database built using any DBMS/RDBMS, submit SQL queries to a database, and retrieve and process the results of SQL queries.
• Is a low-level interface in which SQL select and update statements are called directly from within Java programs.
• Can be used with both two-tier and three-tier database architectures. In two-tier architecture, a Java program invokes the methods of JDBC API, which in turn communicates with the database server. In three-tier architecture, a Java applet or an HTML form submits SQL queries to a middle-tier server. Middle-tier server in turn uses JDBC API to communicate with the database server.
The JDBC architecture is based on a collection of Java interfaces and classes that together enables you to connect to data sourced, to create and execute SQL statements, and to retrieve and modify sata in a database. These operations are illustrated in the figure below:
Each of the boxes in the illustration represents a JDBC class or interface that has fundamental role in accessing a relational database.
JDBC API takes care of converting Java commands to generic SQL statements. However, to address specific database issues, each database vendor provides a driver along with the database. Java Applications invoke the methods JDBC API. JDBC API in turn uses a driver to communicate with a specific database.
JDBC API submits queries to the JDBC driver. The JDBC driver converts queries to a form that a particular DBMS/RDBMS can understand. The JDBC driver also retrieves the results of SQL queries, converts it into equivalent JDBC API classes and objects that can be used by the application. Since the JDBC Driver only takes care of the interactions with database, any change made to the database does not affect the application.
There are several categories of JDBC Drivers provided by different database vendors. They are:
JDBC-ODBC Bridge Driver: The first category of JDBC drivers provides a bridge between the JDBC API and the ODBC API. There are several DBMS/RDBMS, such as MS Access and SQL Server that contain the ODBC Driver embedded into them. Since the ODBC API is written in the C language and makes use of pointers and other constructs that Java does not support, a Java program cannot directly communicate with an ODBC Driver. The bridge translates the standard JDBC calls to corresponding ODBC calls, and sends them to ODBC data source via ODBC libraries.
Native API Partly Java Driver: These drivers use a mixture of Java implementation and vendor specific native APIs to provide data access. JDBC database calls are translated into vendor specific API calls. The database will process the request and sends the result back through the API, which will in turn forward them back to the JDBC driver. The JDBC driver will translate the result to the JDBC standard and return them to the Java application. There is one layer fewer to go through than for a type 1 driver and so in general a type 2 driver will be faster than a type 1 driver.
Some DBMS/RDBMS such as DB2 and Informix contain a JDBC driver supplied by the database vendor.
Intermediate Database Access Server: Type 3 drivers use an intermediate database server that has the ability to connect multiple Java clients to multiple database servers. Clients connect to database server via an intermediate server component that acts as a gateway for multiple database servers. The java client application sends a JDBC call through a JDBC driver to the intermediate data access server, which completes the request to the data sourcing using another driver ( for example, a type 2 driver).
BEA WebLogic includes a type 3 driver. One of the benefit of using a type 3 driver is that it allows flexibility on the architecture of the application, as the intermediate server can can abstract details of connection to database servers.
Native Protocol Pure Java Driver/JDBC-Net Pure Java Driver: These drivers convert the JDBC API calls to direct network calls using vendor specific networking protocol. They do this by making direct socket connections with the database. Type 4 drivers offer better performance than others.