Online Shopping System Project Report
Online Shopping System Project Report
1. Introduction
1.1. Project Description:................................................................. 1
1.2. Technology Used........................................................................ 2
1.2.1. J2EE 1.4.1.............................................................................. 2
1.2.2. JDBC..................................................................................... 4
1.2.3. Hyper Text Markup Language ............................................ 8
1.2.4. Java Script .............................................................................. 9
1.2.5. ORACLE ........................................................................... 10
2. Project life cycle
2.1. Software Development life cycle ......................................... 17
3. Requirement Analysis
3.1. Overview .............................................................................. 21
3.2. Objective of requirement analysis ..................................... 22
3.3. Software requirement specification ..................................... 23
3.3.1. Introduction ........................................................................ 23
3.3.2. Product description............................................................. 24
3.3.3. Usage scenario .................................................................... 25
3.3.4. Data objects and description ............................................ 26
3.3.5. Design constraints ............................................................. 27
4. System Designing
4.1. Overview .............................................................................. 28
4.1.1. Database Design ................................................................. 28
4.1.2. Human – Machine Interface Design .............................. 28
4.2. Software Design specification ................................................ 30
4.2.1. Database Design ................................................................. 30
4.3. Process Model........................................................................ 38
4.3.1. Functional Decomposition Diagram.................................. 38
4.3.2. Data Flow Diagram............................................................. 39
5. Coding ................................................................................................ 46
6. Snapshots
6.1. Visitor interfaces .................................................................... 110
6.2. Administrator interfaces ...................................................... 122
7. Testing and implementation
7.1. Testing ..................................................................................... 130
7.1.1. Testing Objectives ............................................................. 130
7.1.2. Testing Principles ............................................................. 130
7.1.3. Unit Testing ........................................................................ 131
7.1.4. Integration Testing ............................................................. 134
7.1.5. System Testing .................................................................... 136
7.1.6. Optimization Points .......................................................... 138
8. Limitations and Future Developments ......................................... 139
8.1. Conclusion .............................................................................. 139
9. Bibliography
9.1. Books & Authors .................................................................... 142
9.2. Consulted Website ................................................................. 142
a.
1
Introduction
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 online shopping system project report the process of shopping on the web
is becoming commonplace.
The objective of this online shopping system project 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 online shopping system project 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 online shopping system project report 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
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
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
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
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 online shopping system project report
Request Web
Browser Server Check to ensure
(JSP if the call to JSP
Response
Engine) is first of its kind Ye
s
Servlet
Response Generation and
recompilation
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 online shopping system
project report 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 online shopping system project report would
1.2.2 JDBC
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 online shopping system project report are then passed to the program that online shopping system
project report manages the database. It returns the results through a similar interface.
From the user’s point of view, Java application looks something like this online shopping system project:
Java Application
JDBC
Contains a set of classes and interfaces that online shopping system project report are used to
connect to a database built using any DBMS/RDBMS, submit SQL queries to a database, and
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.
JDBC Architecture:
The JDBC architecture is based on a collection of Java interfaces and classes that
online shopping system project report 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:
Database
Each of the boxes in the illustration represents a JDBC class or interface that online
shopping system project report has fundamental role in accessing a relational
database.
JDBC Drivers:
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 online
shopping system project report 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 online shopping
system project report 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.
JDBC Architecture
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 online shopping system project report 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 online shopping system project report 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
online shopping system project report has the ability to connect multiple Java clients to
multiple database servers. Clients connect to database server via an intermediate server
component that online shopping system project report 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
BEA WebLogic includes a type 3 driver. One of the benefit of using a type 3 driver is that
online shopping system project report 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
online shopping system project by making direct socket connections with the database. Type 4
HTML pages are the standard interface to the Internet. This online shopping system project basic language
provides the necessary nuts and bolts for building Web pages.
HTML stands for Hyper Text Markup Language and was developed specifically for use on the system of
links, which can be non sequential in order. HTML is not a programming language. It is a marking up
Using a markup language means that online shopping system project report tags can be added to the words
in the document and web enable them. A tag is a set of descriptive formatting codes used in HTML
document that online shopping system project report instructs a web browser how to display text and
HTML 2.0 is the first standard of HTML specification, released in 1996. HTML 3.6 was the next
specification to be developed. It was a joint effort of many software companies like Microsoft, IBM, Sun
HTML 4.0 is the latest version of HTML, which includes CSS and dynamic HTML
features.
1.2.4. JavaScript
The project uses JavaScript as the client side scripting language for JSP/HTML pages in the project.
JavaScript is an easy to use object-scripting language designed for creating live online applications that
online shopping system project report link together resources on both clients and servers. JavaScript is
designed for use by HTML page authors and enterprise application developers to dynamically script the
behavior of objects running on either the client or the servers. JavaScript ‘s design and concept represent
Netscape Communications Corp. and Sun Microsystems. Originally called Livescript, JavaScript is a
programming language that online shopping system project report can be included on web pages to make
JavaScript is easier to understand, less complex version of its distant cousin, Java. It is a text-based
language that online shopping system project report must be placed within HTML that online shopping
system project report must be placed within, HTML, to be read by the browser and interpreted so the
JavaScript is a preferred language for client side scripting. This online shopping system project is mainly
because when client side scripting is done browser compatibility is an issue of concern and both major
Oracle takes business where it needs to be: meeting and exceeding stringent demands for high-quality
service in a service-driven marketplace. Oracle is designed to optimize traditional, internet and intranet
applications, and to stimulate the emerging hosted application market on the internet.
Oracle builds on historic strengths to offer the first complete and simple software infrastructure for the
internet’s next generation of intelligent, collaborative applications. The Oracle new features expedite
delivery of critical performance, scalability, and availability essential to providing hosted service software
Oracle Database
Oracle Database:
The Oracle Database introduces the following advanced and automated design features that online
shopping system project report refine Oracle Application Server and Oracle Developer Suite to optimize
performance for traditional applications and the emerging hosted application market.
The next evolutionary step after Oracle Parallel Server, Oracle Real Application Clusters provides out-of-
the-box, linear scaling transparency, compatibility with all applications without redesign, and the ability to
Systems Management
Integrated system management products create a complete view of all critical components that online
shopping system project report drive e-business processes. From the client and application server to the
database and host, Oracle quickly and completely assesses the overall health of an e-business infrastructure.
High Availability
Setting a new standard for high availability, Oracle introduces powerful new functionality in areas of
High Security
Oracle offers the most secure internet platform for protecting company information through multiple layers
of security for data, users, and companies. Included are features for building internet-scale applications, for
providing security for users, and for keeping data from different hosted user communities separate.
offers the industry’s most innovative and comprehensive set of middle-tier services.
Continued innovation within comprehensive middle-tier services, ranging from self service enterprise
portals, to e-stores and supplier exchange, sustains the Oracle Application Server as the industry’s preferred
The new caching technology in Oracle can dramatically increase Web site performance, scalability, and
availability. Greater numbers of users can be provided with more personalized, dynamic Web content
Superb scalability and performance now is made available for all Web applications. Oracle Portal services
make it easy for Web site developers to deploy enterprise portals with centralized management and unified
security. Standard Java, with rich XML and content management support, as well as back-office
transactional applications built using Oracle Forms Developer, can easily be deployed.
Information in any database or internet application is easily available through Oracle. Support for each
Business Intelligence
Oracle Application Server has built-in reporting and ad hoc query functionality to derive business
intelligence tools, and enterprise portal building tools in a single, integrated product. Built on internet
standards such as Java, XML, CORBA, and HTML, the Oracle Internet Developer Suite provides a high-
performance development environment with tools needed to respond to rapidly changing markets and user
demands.
Oracle Internet Developer Suite tools are suitable for any kind of development approach, including
component-based development, Java coding, and visual modeling, and offer rapid application development
based on 4GL. Applications can be developed for all clients, including High Productive Java Client,
Tools
Oracle Internet Developer Suite tools include: Oracle Forms Developer; Oracle Designer; Oracle
JDeveloper and Business Components for Java; Oracle Reports Developer; and Oracle Discoverer.
Other Features
All applications are single, middle-tier deployable with an Oracle Application Server. Oracle Portal is
available for an integrated, personalized portal view with all applications. Integrated business intelligence
1. Availability:
Oracle dramatically extends Oracle’s leadership in Internet database availability, which is critical for any e-
2. Scalability:
Oracle allows e-business to scale the most demanding e-business applications with intensive transactions
Oracle is the continued performance leader in all relevant areas. Measurement and tuning projects continue
to improve Oracle runtime performance. Major focus performance improvements in Oracle are in areas
4. Security:
Oracle continues to provide the most secure application development and deployment platform in the
SQLPLUS is usually thought of as a kind of interactive report writer. It uses SQL to get information from the
Oracle database, and lets you create reports by giving you easy control over titles, column headings, subtotals
and totals, reformatting of numbers and text, and much more. It also can be used to change the database by
using insert, update, and delete commands in SQL. SQLPLUS can even be used as a code generator, where a
series of commands in SQLPLUS can dynamically build a program and then execute it.
In most production applications, more advanced report writers are used—such as Web-based parameter-driven
reports. SQLPLUS is most commonly used for simple queries and printed reports. Getting SQLPLUS to format
information in reports according to your taste and needs requires only a handful of commands, or keywords that
You can write SQLPLUS reports while working interactively with SQLPLUS—that online shopping system
project report is, you can type commands about page headings, column titles, formatting, breaks, totals, and so
on, and then execute a SQL query, and SQLPLUS will immediately produce the report formatted to your
specifications. For quick answers to simple questions that online shopping system project report aren’t likely to
recur, this online shopping system project is a fine approach. More common, however, are complex reports that
online shopping system project report need to be produced periodically, and that online shopping system project
report you’ll want to print rather than just view on the screen. Unfortunately, when you quit SQLPLUS, it
promptly forgets every instruction you’ve given it. If you were restricted to using
SQLPLUS only in this online shopping system project interactive way, then running the same report at a later
The alternative is very straightforward. You simply type the commands, line by line, into a file. SQLPLUS can
then read this online shopping system project file as if it were a script, and execute your commands just as if
you were typing them. In effect, you create a report program, but you do it without a programmer or a compiler.
You create this online shopping system project file using any of the popular editor programs available or even
The editor is not a part of Oracle. Editors come in hundreds of varieties, and every company or person seems to
have a favorite. Oracle realized this online shopping system project, and decided to let you choose which editor
program to use, rather than packaging a program with Oracle and forcing you to use it. When you’re ready to
use your editor program, you suspend SQLPLUS, jump over to the editor program, create or change your
SQLPLUS report program (also called a start file), and then jump back to SQLPLUS right at the spot you left
and run that online shopping system project report report (see Figure 6-1).
SQLPLUS also has a built-in editor of its own, sometimes called the command line editor, which allows you to
Preliminary Investigation : -
An important outcome of the preliminary investigation is the determination that
online shopping system project report system is feasible or not. In the conduct of
feasibility study, there are three major distinct and interrelated areas were taken into
consideration. They are as follows:
1. Technical Feasibility :
The System of operation which was functioning earlier was totally manual, with no
kind of automation or computerization. All the departments were maintaining
separate registers for keeping various records. Due to expansion of schools more
workspace and it appears a tedious task to maintain with specifying equipment and
software that online shopping system project report will successfully support the
tasks required. As a result the computerized system is technically feasible as it is
efficient, less time consuming, can produce outputs faster, can input large amount of
data in limited time scale and easier to use in operation
2. Operational Feasibility : -
The ultimate users i.e. the people who are supposed to use the system are trained for
a period of one month so as to get familiar with the new system and its operation.
They are taught about the new skills and the new technology and how the
technology will be useful to them in their functioning. Operational feasibility is
concerned with human, organizational and political aspects. General impression of
these factors is gained from the corporate appraisal.
3. Economical Feasibility :
The computerized system is economically feasible in the sense the cost of the
hardware and software and the cost to training of personnel of the company to
operate the system and the installation cost is less than the cost of maintaining the
registers. This online shopping system project may not be a big sum in the long run
of the school business. Also the time taken for the entire process of formulation,
checking, studying and installation of the project has been equal to one working
month of the school. As a result, there has been no hesitation on pert of the
management in adopting the new system.
Requirements analysis :-
Analysis of requirements includes studying the existing system and collecting data.
During analysis, data are collected on the available files, decision points and
transaction handled by the present system. Once the structured analysis is
completed, the analyst has affirmed understanding of what is to be done.
System Designing:
The design of an information system produces the details that online shopping
system project report clearly describe how a system will meet the requirements
identified during system analysis. System analysts begin the design process by
identifying reports and other outputs system will produce. The system design also
describes the data to be input, calculated or stored.
Coding: -
This online shopping system project is the phase in which computer based system is
constructed from the specifications prepared in the design phase. Equipment is
acquired and installed during the development phase. All necessary procedure,
manuals software specifications, and other documentation are completed. The staff
is trained.
System Testing:-
During system testing, the system is used experimentally to ensure that online
shopping system project report the software does not fail. In other words we can say
that online shopping system project report it will run according to its specifications
and in the way users expect. Special test data are input for processing, and the result
examined.
Problem Analysis
Requirement Analysis
Validation
Validated
SRS
This online shopping system project is the most important step in a software project
where we get a general idea about the needs of the customers or end users by having man
to man conversation with them and about the various conditions and restrictions that
online shopping system project report have to be taken care of while developing the
software application.
The purpose of this online shopping system project phase is to identify, analyze and
document the exact requirements for the system. The developer, customer, a marketing
organization, or any combination of the three may perform such study. It is extremely
important that online shopping system project report the developers of the system study
the existing system thoroughly otherwise it is impossible to satisfy the needs of the user.
The requirements at this online shopping system project stage are in end-user terms.
During the Requirement Analysis Phase, the development team analyzes the
requirements to be fulfilled by the Online Shoping Cart website and identifies the
probable approach for meeting these requirements. To identify the requirements needed
by the website, we decided to study the existing Shopping Cart process like Searching
Book, Adding to Cart, money transfer. In this online shopping system project phase we
have also collect necessary information regarding the details to be stored Registered
customer.
Identification of need
Information Gathering
1. Identification of Need:
The success of the system depends largely on how accurately a problem is defined,
thoroughly investigated, and properly carried out through the choice of solution. Users
need identification and analysis is concerned with what the user needs rather then what
he/she wants. Until the problem has been identified, defined, and evaluated the analyst
shouldn't think about solutions and whether the problem is worth solving or not.
2. Information Gathering:
A key part of system development is gathering information. The analyst must know what
information to get, where to find it, how to collect it, and how to make use of it. The
proper use of tools for gathering information is the key to successful analysis.
3. Feasibility Study:
Feasibility study is carried out to test if the proposed system is feasible in terms of
economy, technology, resource availability etc. As such, given unlimited resources and
infinite time, all projects are feasible. Unfortunately, such results and time are not
possible in real life situations. Hence it is both necessary and prudent to evaluate the
feasibility of the project at the earliest possible time in order to avoid unnecessary
wastage of time, effort and professional embarrassment over an ill conceived system.
3.3.1 Introduction:
A. Purpose:
This online shopping system project document completely describes what the “Shopping
Cart” should do without describing how the software will do it. The basic goal of the
requirement phase is to produce the SRS, which describing the complete external
behavior of the purposed software.
B.
Scope:
This online shopping system project document is the only one that online shopping
system project report describes the requirements of the system. It is meant for use by the
developer and will be the basis for validating the final delivered system. Any changes
made to the requirements in the future will have to go through a formal changes approval
process. The developer is responsible for asking for clarifications, where necessary, and
will not make any alteration without the permission of the client.
C.
Developer’s responsibility:
The developer is responsible for:
(a) Developing the system.
(b) Installing the software on the client’s hardware.
(c) Conducting any user training that online shopping system project report might be
needed for using the system.
(d) Maintaining the system for a period of one year after installation.
3.3.2 Product description:
This online shopping system project section provides an overview of the software. This
online shopping system project section describes the goal and objective of the software.
This online shopping system project section also briefly describes the general
requirements of the software. This online shopping system project section is very
important for the verification of the software after the completion whether the objective
and requirements of the software will met or not.
3 User Profiles:
There will be three levels of users:
Administrator level (Employee)
User level (Account Holder)
4 Use-cases:
5 Administrator level:
This online shopping system project level of users will be able to insert new Books, new
Category and Price information,. They will also be able to generate
User Level:
This online shopping system project level of users will be able to Search the books, Order
the books etc. They can view their records.
A. Hardware Requirement:
I. Server (Windows 2000 Server (NT))
Microsoft 2000 Server is based on NT Technology biased to run server side
scripts in ASP technology.
Disk Space 3 GB.
Web Server Microsoft IIS (6.0)
II. Client
B. Software Requirement:
Operating System : Windows 2000 / NT / XP
It includes consideration of the kinds of the users who will use the equipment, their
diverse backgrounds and skills, the user expectations as well as their physical
characteristics. The users who posses high degree of skill often prefer more powerful
functions which usually means greater complexity, unskilled operations, on the other
hand, would simple functions which are easier to learn and use.
Task Characteristics:
The nature of the users tasks differ and therefore the needs for specific-kinds of service
from the system. For example unstructured tasks usually requires a more flexible mode of
interaction to meet the varying needs of users as opposed to structured tasks, which are
more predictable and repetitive. The sequence and frequency with which certain tasks are
performed will also affect the optimal design of the user interface.
Functional Characteristics:
It refers to the various functions required to perform the tasks and the ease with which
these functions can be learnt made use of by the users while ascertaining the functional
characteristics, the support facilities required to perform the functions, also need to be
taken into account. These include facilities like training, on line help, documentation,
expert system etc. the other aspect of functional characteristics of a system its
performance criteria like response time, fault tolerance etc.
6 INPUT DESIGN:
The most common cause of errors in data processing is inaccurate input data. Errors
entered by data entry operators can be controlled by the input design. Input design is the
process of converting user-oriented inputs to computer based formats. The goal of input
design to make data entry easy logical and free from errors.
7 OUTPUT DESIGN:
Computers are the most important source of information to the user. Inputs are fed into
computers to acquire the required outputs. The computers can provide valuable
information’s in the form of well-documented outputs for various values. The major form
of output is a hardcopy (reports) from the printer. Reports are around the output
requirements of the user.
This online shopping system project section provides an overview of the entire design
document. This online shopping system project document describes all data, architectural,
interface and component-level design for the software.
A. Tables description:
Table 1:
8 Table Definition:
Foreign Key :
Columns Definition:
SIZ NULLS
S. NO. NAME DATA TYPE DEFAULT VALUE
E ?
1 CategoryId Number 5 No
CategoryNam
2 VARCHAR2 25 No
e
Table Description:
Table 2:
9 Table Definition:
Purpose : Stores details about books such as book title, author etc.
Foreign Key :
CATEGORY_DETAILS.CATEGORYID→BOOK_DETAILS.CATEGORY
Columns Definition:
SIZ NULLS
S.NO. NAME DATA TYPE DEFAULT VALUE
E ?
1 BookId Number 5 No
2 CategoryId Number 5 No
3 Title VARCHAR2 50 No
4 Author VARCHAR2 30 No
5 Publisher VARCHAR2 30 No
6 Edition VARCHAR2 5 No
7 Price Number 7,2 No
8 Quantity Number 3 No
9 Description Varchar2 100 Yes
Table description:
Table 3:
10 Table Definition:
Table Name : ODER_DETAILS
Purpose : Stores information about the order placed by the end user.
Primary Key :
Columns Definition:
S.NO. NAME DATATYP SI NULL DEFAULT VALUE
E ZE S?
1 ORDERID NUMBER 5 No
2 BOOKID NUMBER 5 No
3 QUANTIT NUMBER 3 No
Y
Table Description:
11 Table Definition:
Purpose :This online shopping system project table will holds the details about the
book that online shopping system project report have been searched by the
end user.
Primary Key :
Foreign Key :
Columns Definitions:
SIZ NULLS
S.NO. NAME DATA TYPE DEFAULT VALUE
E ?
1 BookId Number 5 No
2 CategoryId Number 5 No
3 Title VARCHAR2 50 No
4 Author VARCHAR2 30 No
5 Publisher VARCHAR2 30 No
6 Edition VARCHAR2 5 No
7 Price Number 7,2 No
8 Quantity Number 3 No
9 Description Varchar2 100 Yes
Table description:
Table 5:
12 Table Definition:
Foreign Key :
Columns Definition:
13 Table Definition:
Primary Key :
Columns definition:
A Process Model tells us about how the data is processed and how the data flows
from one table to another to gather the required information. This online shopping system
project model consists of the
Functional Decomposition Diagram and Data Flow Diagram.
Data Flow Diagrams for the current system. Each process within the system is first
shown as a Context Level DFD and later as a Detailed DFD. The Context Level DFD
provides a conceptual view of the process and its surrounding input,output and data
stores. The Detailed DFD provides a more detailed and comprehensive view of the
interaction among the sub-processes within the system.
Customer-Browse Context DFD
Customer-Authentication-UserProfile DFD
Authenticated User-Purchase Context DFD
Authenticated User-Purchase DFD
5
Coding
Login.html
<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
</CENTER>
<SCRIPT language="JavaScript">
function validate()
{
if(document.frm.UserName.value==""||
document.frm.Password.value=="")
{
alert("UserName or Password cannot be blank!!");
return;
}
document.frm.action="Validate.jsp";
document.frm.submit();
}
</SCRIPT>
<form name = frm method="POST">
<p align="center"><font size="5"><b>Login Form</b></font></p>
<TABLE ALIGN="center" height="57">
<TR>
<TD >
<b>UserName:</b>
</TD>
<TD >
<input type="text" name="UserName" size="20" tabindex="1">
</TD>
</TR>
<TR>
<TD >
<b>Password:</b>
</TD>
<TD >
<input type="password" name="Password" size="20" tabindex="2">
</TD>
<TR align="center">
<TD colspan=2>
<input type="button" value=" Login " name="B1" onclick="validate();"
tabindex="3">
</TD>
</TR>
<TR >
<TD ><font size="4">New User?</font></TD>
<TD><a href="NewUser.htm"><font ize="4">Register</font></a></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
NewUser.html
<html>
<head>
<title>New User Registration</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
</CENTER>
<form name="form1" method="POST" >
<SCRIPT language="JavaScript">
function validate()
{
if( document.form1.UserName.value=="")
{
alert("UserName cannot be blank");
return;
}
if( document.form1.Password.value=="")
{
alert("Password cannot be blank");
return;
}
if( document.form1.Password.value!= document.form1.Password2.value)
{
alert("The two passwords do not match");
return;
}
if( document.form1.FirstName.value=="")
{
alert("First Name cannot be blank");
return;
}
if(document.form1.LastName.value=="")
{
alert("Last Name cannot be blank");
return;
}
if( document.form1.Address1.value=="")
{
alert("Address cannot be blank");
return;
}
if( document.form1.City.value=="")
{
alert("City cannot be blank");
return;
}
if( document.form1.State.value=="Select State")
{
alert("You must select a state");
return;
}
if( document.form1.PinCode.value=="")
{
alert("PinCode cannot be blank");
return;
}
if( document.form1.Email.value=="")
{
alert("Email ID cannot be blank");
return;
}
if( document.form1.Phone.value=="")
{
alert("Phone Number cannot be blank");
return;
}
document.forms[0].action="Sign.jsp";
document.forms[0].submit();
}
</SCRIPT>
<p align="center">
<b><font size="5"> New User Registration</font></b>
</p>
<p align="left">
<b><font color="#FF0000">( Field marked * are
necessary)</font> &nbs
p;  
;
</b>
</p>
<div align="left">
<table border="0" width="100%">
<tr>
<td width="23%"><b>User *:</b></td>
<td width="77%">
<b>
<input type="text" name="UserName" size="20" tabindex="1">
</b>
</td>
</tr>
<tr>
<td width="23%">
<b>
Password*:</b></td>
<td width="77%"><b><input type="password" name="Password" size="20"
tabindex="2">
</b>
</td>
</tr>
<tr>
<td width="23%">
<b>
Confirm Password*:</b>
</td>
<td width="77%"><b><input type="password" name="Password2" size="20"
tabindex="3">
</b>
</td>
</tr>
<tr>
<td width="23%">
<b>
First Name*:</b></td>
<td width="77%">
<b><input type="text" name="FirstName" size="20" tabindex="4">
</b>
</td>
</tr>
<tr>
<td width="23%">
<b>
Middle Name:</b></td>
<td width="77%">
<b>
<input type="text" name="MiddleName" size="20" tabindex="5">
</b>
</td>
</tr>
<tr>
<td width="23%">
<b>
Last Name*:</b></td>
<td width="77%">
<b><input type="text" name="LastName" size="20" tabindex="6">
</b>
</td>
</tr>
</table>
</div>
<div align="center">
<center>
<table border="0" width="100%" height="201">
<tr>
<td width="23%" height="25"><b>Address1*: </b></td>
<td width="77%" height="25"><b><input type="text" name="Address1" size="43"
tabindex="7"> </b> </td>
</tr>
<tr>
<td width="23%" height="25"><b>Address2: </b></td>
<td width="77%" height="25"><b><input type="text" name="Address2" size="43"
tabindex="8"> </b> </td>
</tr>
<tr>
<td width="23%" height="25"><b>City*: </b></td>
<td width="77%" height="25"><b><input type="text" name="City" size="20"
tabindex="9"> </b> </td>
</tr>
<tr>
<td width="23%" height="25"><b>State*:</b></td>
<td width="77%" height="25"><b><select size="1" name="State" tabindex="10">
<option selected value="Select State">Select State</option>
<option>Assam</option>
<option>Arunachal Pradesh</option>
<option>Haryana</option>
<option>Maharashtra</option>
<option>Rajasthan</option>
<option>Uttar pradesh</option>
</select> </b> </td>
</tr>
<tr>
<td width="23%" height="25"><b>Pin Code*: </b></td>
<td width="77%" height="25"><b><input type="text" name="PinCode" size="20"
tabindex="11"> </b> </td>
</tr>
<tr>
<td width="23%" height="25"><b>Email ID*:</b></td>
<td width="77%" height="25"><b><input type="text" name="Email" size="20"
tabindex="12"> </b> </td>
</tr>
<tr>
<td width="23%" height="25"><b>Phone Number*:</b></td>
<td width="77%" height="25"><b><input type="text" name="Phone" size="20"
tabindex="13"> </b> </td>
</tr>
<tr>
<td width="23%" height="1"></td>
<td width="77%" height="1"> </td>
</tr>
<tr>
<td width="23%" height="21"></td>
<td width="77%" height="21">
<b>
<input type="submit" value="Submit" name="B1" onclick="validate();"
tabindex="13">
</b>
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</HTML>
Sign.jsp
<html>
<body bgcolor="#CCFFFF">
<%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %>
<%
Connection conn;
conn=null;
ResultSet rs;
rs=null;
String UserName=request.getParameter("UserName");
String Password=request.getParameter("Password");
String Password2=request.getParameter("Password2");
String FirstName=request.getParameter("FirstName");
String MiddleName=request.getParameter("MiddleName");
String LastName=request.getParameter("LastName");
String Address1=request.getParameter("Address1");
String Address2=request.getParameter("Address2");
String City=request.getParameter("City");
String State=request.getParameter("State");
String PinCode=request.getParameter("PinCode");
String Email=request.getParameter("Email");
String Phone=request.getParameter("Phone");
int flag=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
PreparedStatement stat= conn.prepareStatement("SELECT * FROM
user_profile where username=?" );
stat.setString(1,UserName);
rs = stat.executeQuery();
out.println("query executed");
if(rs.next())
{
flag=1;
%>
<SCRIPT language="JavaScript">
alert("User name already exists");
location.href="NewUser.htm";
</SCRIPT>
<%
}
else
{
flag=0; // conn.close();
}
}
catch(Exception E)
{
out.println("Error "+E);
}
if(flag == 0)
{
try
{
stat.executeUpdate();
stat1.executeUpdate();
flag=0;
response.sendRedirect("Login.htm");
}
catch(Exception E)
{
out.println("Error inserting value"+E);
}
finally
{
rs.close();
conn.close();
}
%>
</body>
</html>
Validate.jsp
<html>
<body>
<%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %>
<%
Connection conn;
conn=null;
ResultSet rs;
rs=null;
try
{
String strName=request.getParameter("UserName");
String strPass=request.getParameter("Password");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
PreparedStatement stat= conn.prepareStatement("SELECT * FROM
user_auth where username=? and password =?");
stat.setString(1,strName);
stat.setString(2,strPass);
rs = stat.executeQuery();
if(rs.next())
{
String str1,str2;
str1=rs.getString(1);
str2=rs.getString(2);
out.println(str1+str2);
session.putValue("user",strName);
if(str1.equals("Administrator"))
{
response.sendRedirect("Admin.htm");
}
else
{
out.println("Logged IN");
response.sendRedirect("SearchCriteria.jsp");
}
}
else
{
response.sendRedirect("InvalidUser.htm");
}
}
catch(Exception E)
{
out.println("Error "+E);
}
finally
{
rs.close();
conn.close();
}
%>
</body>
</html>
SearchCriteria.jsp
<html>
<head>
<title>Search Items</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
</CENTER>
<SCRIPT language="JavaScript">
function startSearch()
{
if(document.frm.R1[1].checked)
{
if(document.frm.BookTitle.value=="")
{
alert("You must enter a book title");
return;
}
}
if(document.frm.R1[2].checked)
{
if(document.frm.BookAuthor.value=="")
{
alert("You must enter an author name");
return;
}
}
if(document.frm.R1[3].checked)
{
if(document.frm.BookPublisher.value=="")
{
alert("You must enter a publisher name");
return;
}
}
document.frm.action="search.jsp";
document.frm.submit();
}
</SCRIPT>
rs=stat.executeQuery();
%>
</form>
<%
}
catch(Exception e)
{
out.print("Error = " + e + "<HR>");
}
finally
{
rs.close();
con.close();
}
%>
</body>
</html>
Search.jsp
<%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %>
<html>
<head>
<title>Search Results</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
<font size="5" >Search Results</font>
</CENTER>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
<%
String str_searchvar=null;
int chk_ctr=0;
String str_colvar=null;
String tab_var="";
String user_src=(String)session.getValue("user");
System.out.println("0");
if (user_src!=null)
{
String query=null;
Connection conn;
conn=null;
ResultSet rs;
rs=null;
if(request.getParameter("R1").equals("Title"))
{
str_searchvar=request.getParameter("BookTitle");
str_colvar="TITLE";
}
if(request.getParameter("R1").equals("Category"))
{
chk_ctr=1;
str_searchvar=request.getParameter("BookCategory");
str_colvar="Categoryname";
}
if(request.getParameter("R1").equals("Publisher"))
{
str_searchvar=request.getParameter("BookPublisher");
str_colvar="Publisher";
}
if(request.getParameter("R1").equals("Author"))
{
str_searchvar=request.getParameter("BookAuthor");
str_colvar="Author";
}
if (request.getParameter("R2")==null)
{
tab_var="BOOK_DETAILS";
}
else
{
// to get the name of the table in which the search to be done-------
if (request.getParameter("R2").equals("A"))
{
tab_var="TEMP_DETAIL";
}
else
{
tab_var="BOOK_DETAILS";
}
}
System.out.println(str_searchvar);
query = "select a.* from "+tab_var+" a, category_details b where a."+str_colvar+"
= ? and a.CATEGORYID = b.CATEGORYID";
System.out.println("1");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
int ctr=0;
System.out.println("2");
PreparedStatement stm = conn.prepareStatement(query);
stm.setString(1,str_searchvar);
rs = stm.executeQuery();
%>
<%
while(rs.next())
{
System.out.println("inside while");
ctr=ctr+1;
out.println("<tr><td>"+ctr+"</td>");
int int_BOOKID=0;
int_BOOKID=rs.getInt(1);
System.out.println(int_BOOKID);
out.println("<td><input type=checkbox name=chk"+ctr+"
value="+int_BOOKID+">");
int int_CATEGORYID=rs.getInt(2);
String str_TITLE=rs.getString(3);
out.println("<td>");
out.println(str_TITLE);
out.println("</td>");
String str_AUTHOR=rs.getString(4);
out.println("<td>");
out.println(str_AUTHOR);
out.println("</td>");
String str_PUBLISHER=rs.getString(5);
out.println("<td>");
out.println(str_PUBLISHER);
out.println("</td>");
String str_EDITION=rs.getString(6);
out.println("<td>");
out.println(str_EDITION);
out.println("</td>");
int int_PRICE=rs.getInt(7);
out.println("<td>");
out.println(int_PRICE);
out.println("</td>");
int int_QUANTITY=rs.getInt(8);
out.println("<td>");
out.println(int_QUANTITY);
out.println("</td>");
String str_DESCRIPTION=rs.getString(9);
out.println("<td>");
out.println(str_DESCRIPTION);
out.println("</td></tr>");
String ins_query ="INSERT INTO temp_detail VALUES (?,?,?,?,?,?,?,?,?)";
PreparedStatement stat_ins= conn.prepareStatement(ins_query);
stat_ins.setInt(1,int_BOOKID);
stat_ins.setInt(2,int_CATEGORYID);
stat_ins.setString(3,str_TITLE);
stat_ins.setString(4,str_AUTHOR);
stat_ins.setString(5,str_PUBLISHER);
stat_ins.setString(6,str_EDITION);
stat_ins.setInt(7,int_PRICE);
stat_ins.setInt(8,int_QUANTITY);
stat_ins.setString(9,str_DESCRIPTION);
int x = stat_ins.executeUpdate();
System.out.println(x);
}
String str_ctr=String.valueOf(ctr);
session.putValue("ctr_val",str_ctr);
%>
</table>
<br>
<input type="submit" value=" Add to Cart " name="Add">
</form>
<%
rs.close();
stm.close();
}
catch(Exception e){}
}
else
{
response.sendRedirect("Unauthorised.htm");
}
%>
</body>
</html>
Inter_Cart.jsp
<%@ page errorPage="errorpage.jsp" language="java" %>
<%
int i;
String bookid=null;
String user_src=null;
user_src=(String)session.getValue("user");
if (user_src!=null)
{
int counter=0;
counter=Integer.parseInt((String)session.getValue("ctr_val"));
int ctr=0;
for(i=1;i<=counter;i++)
{
if(request.getParameter("chk"+i)!=null)
{
bookid=request.getParameter("chk"+i);
ctr=ctr+1;
session.putValue("chk_var"+ctr,bookid);
}
}
session.putValue("TotalSel",String.valueOf(ctr));
response.sendRedirect("Cart.jsp");
}
else
{
response.sendRedirect("Unauthorised.htm");
}
%>
Cart.jsp
<html>
<head>
<title>Shopping Cart</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
</CENTER>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
PreparedStatement stat=null;
int ctr=0,bookprice=0;
for(i=1;i<=counter;i++)
{
if((String)session.getValue("chk_var"+i)!=null)
{
bookid[i-
1]=Integer.parseInt((String)session.getValue("chk_var"+i));
}
}
session.putValue("BookArr",bookid);
%>
rs = stat.executeQuery();
while (rs.next())
{
out.println("<td>");
out.println(rs.getString(1));
out.println("<td>");
price=rs.getInt(2);
out.println(price);
}
rs.close();
bookprice=bookprice+price;
session.putValue("bPrice",String.valueOf(bookprice));
out.println("</tr>");
}
ResultSet rscombo=null;
String query1="select * from category_details";
PreparedStatement stat_combo = conn.prepareStatement(query1);
rscombo=stat_combo.executeQuery();%>
<tr>
<td colspan=3>Total Cart Amount(in Rs.)=
<%=bookprice%><td>
</tr>
</table>
<br>
<input type=submit value="Place Order">
</form>
<br><hr><h3>Search More</h3>
<script language="Javascript">
function check_sum()
{
var cost=0;
x_avlqty=new Array(<%=counter%>);
y_orderqty=new Array(<%=counter%>);
z_price=new Array(<%=counter%>);
for (var i=0;i<<%=counter%>;i++)
{
z_price[i]=(document.shop.elements[i*4].value);
x_avlqty[i]=document.shop.elements[i*4+1].value;
y_orderqty[i]=document.shop.elements[i*4+2].value;
if(parseInt(y_orderqty[i])<0)
{
alert("Book quantity cannot be Negative");
return false;
}
if (parseInt(x_avlqty[i])<parseInt(y_orderqty[i]))
{
alert("Order Quantity Cannot be greater than available
quantity");
return false;
}
else
{
document.shop.elements[i*4+3].value=((parseInt(y_orderqty[i]))*(parseInt(z_price[i])));
cost=cost+parseInt(document.shop.elements[i*4+3].value);
}
}
document.shop.tot_val.value=cost;
}
</script>
<%
int[] bookid=new int[counter];
Connection conn;
conn=null;
ResultSet rs;
rs=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
PreparedStatement stat=null;
int ctr=0,bookprice=0;
for(i=1;i<=counter;i++)
{
if((String)session.getValue("chk_var"+i)!=null)
{
bookid[i-
1]=Integer.parseInt((String)session.getValue("chk_var"+i));
}
}
session.putValue("BookArr",bookid);
%>
while (rs.next())
{
out.println("<td>");
out.println(rs.getString(1));out.println("</td>");
price=rs.getInt(2);%>
<td><input type="hidden" name="bk_price<%=j%>"
value=<%=price%></td>
<%out.println(price);
qty_avbl=rs.getInt(3);%>
<td><input type=hidden name="qty_avl<%=j%>" value=<
%=qty_avbl%>><%=qty_avbl%></td>
<td><input type=text name="qty<%=j%>" value="0"
onChange="return check_sum();"></td>
<td><input type=text name="cal_amt<%=j%>"></td>
<%
}%>
</tr>
<%
rs.close();
bookprice=bookprice+price;
session.putValue("bPrice",String.valueOf(bookprice));
out.println("</tr>");
}%>
<tr><td><td><td><td><td>Total Amount(in Rs.)<td><input type="text"
name="tot_val" value="0"></td></tr>
</table>
<br>
<input type=submit value="Place Order">
</form>
<br><hr>
<%}
else
{
response.sendRedirect("Unauthorised.htm");
}
%>
</body>
</html>
NewSearch.jsp
<html>
<head>
<title>Search Results</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
</CENTER>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
<%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %>
<%
String user_src=(String)session.getValue("user");
if (user_src!=null)
{
String str_searchvar=null;
String str_colvar=null;
String query="";
String tab_var="";
int total_sel=Integer.parseInt((String)session.getValue("TotalSel"));
int[] old_bookid=new int[total_sel];
Connection conn;
conn=null;
ResultSet rs;
rs=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
PreparedStatement stat=null,stat_ins=null,stat_del=null;
for (int i=1;i<=total_sel;i++)
{
old_bookid[i-1]=Integer.parseInt((String)session.getValue("chk_var"+i));
}%>
<h3>Your Cart Details are as follows:</h3>
<form name="shop" action="Cart_quantity.jsp">
<table border=1>
<tr>
<td>S.No</td>
<td>Book Name</td>
<td>Price (in Rs.)</td>
</tr>
<%
int price=0; int bookprice=0;
for (int j=0;j<total_sel;j++)
{
out.println("<tr><td>"+j+1);
query="select title, price from book_details where bookid=?";
stat= conn.prepareStatement(query);
stat.setInt(1,old_bookid[j]);
rs = stat.executeQuery();
while (rs.next())
{
out.println("<td>");
out.println(rs.getString(1));
out.println("<td>");
price=rs.getInt(2);
out.println(price);
}
rs.close();
bookprice=bookprice+price;
out.println("</tr>");
}%>
<tr>
<td colspan=3>Total Cart Amount(in Rs.)=
<%=bookprice%>
<td></tr>
</table>
<br>
<input type=submit value="Place Order">
</form>
<%
String test_src=null;
int chk_ctr=0;
if(request.getParameter("R1").equals("Title"))
{
str_searchvar=request.getParameter("BookTitle");
str_colvar="Title";
}
if(request.getParameter("R1").equals("Category"))
{
chk_ctr=1;
str_searchvar=request.getParameter("BookCategory");
str_colvar="Categoryname";
}
if(request.getParameter("R1").equals("Publisher"))
{
str_searchvar=request.getParameter("BookPublisher");
str_colvar="Publisher";
}
if(request.getParameter("R1").equals("Author"))
{
str_searchvar=request.getParameter("BookAuthor");
str_colvar="Author";
}
String ss = request.getParameter("R2");
if (request.getParameter("R2")==null)
{
tab_var="book_details";
}
else
{
// to get the name of the table in which the search to be done-------
if (request.getParameter("R2").equals("A"))
{
tab_var="temp_detail";
}
else
{
tab_var="book_details";
}
}
try
{
stat=conn.prepareStatement(query);
stat.setString(1,str_searchvar);
rs = stat.executeQuery();
int ctr=0;%>
<h3>Search Results are as follows:</h3>
<form name="cart" action="NewInter_cart.jsp" method="POST">
<table border=1>
<tr>
<td>S.No</td>
<td>Select</td>
<td>Book Name</td>
<td>Author Name</td>
<td>Publisher</td>
<td>Edition</td>
<td>Price (in Rs.)</td>
<td>Quantity Available(Nos.)</td>
<td>Description</td>
</tr>
<%
String delete_query="Delete from TEMP_DETAIL";
stat_del= conn.prepareStatement(delete_query);
String ins_query=null;
int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY;
String
str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION;
int rs_del=stat_del.executeUpdate();
while(rs.next())
{
ctr=ctr+1;
out.println("<tr><td>"+ctr);
int_BOOKID=rs.getInt(1);
out.println("<td><input type=checkbox name=chk"+ctr+"
value="+int_BOOKID+">");
int_CATEGORYID=rs.getInt(2);
str_TITLE=rs.getString(3);
out.println("<td>");
out.println(str_TITLE);
str_AUTHOR=rs.getString(4);
out.println("<td>");
out.println(str_AUTHOR);
str_PUBLISHER=rs.getString(5);
out.println("<td>");
out.println(str_PUBLISHER);
str_EDITION=rs.getString(6);
out.println("<td>");
out.println(str_EDITION);
int_PRICE=rs.getInt(7);
out.println("<td>");
out.println(int_PRICE);
int_QUANTITY=rs.getInt(8);
out.println("<td>");
out.println(int_QUANTITY);
str_DESCRIPTION=rs.getString(9);
out.println("<td>");
out.println(str_DESCRIPTION);
out.println("</tr>");
int rs_ins=stat_ins.executeUpdate();
}
String str_ctr=String.valueOf(ctr);
session.putValue("ctr_val",str_ctr);
%>
</table>
ResultSet rscombo=null;
String query1="select * from category_details";
PreparedStatement stat_combo = conn.prepareStatement(query1);
rscombo=stat_combo.executeQuery();%>
<tr>
<td><input type="radio" name="R2" value="A">Advanced Search</td>
<td><input type="radio" name="R2" value="N" checked>New
Search</td>
<td><input type=submit value="Search"></td>
</tr>
</table>
</form>
<%}
catch(Exception E)
{
out.println("Error "+E);
}
finally{conn.close();}
}
else
{
response.sendRedirect("Unauthorised.htm");
}
%>
</body>
</html>
Shop.jsp
<html>
<head>
<title>Order Details</title>
</head>
<body bgcolor="#CCFFFF">
<CENTER>
<H1> <u>Online Shopping Cart</u> </H1>
</CENTER>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
<%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %>
<%
if (session.getValue("user")!=null)
{%>
<script language="Javascript">
function validate()
{
var r = document.form1;
var creditcard=r.Card.value;
var year = r.Year.value;
var month = r.Month.value;
var day = r.Day.value;
if(creditcard.length!=16)
{
alert("Invalid Credit Card Number");
r.Card.focus();
return;
}
//-----------------------------------------------------------------------
if(day=="Select Day")
{
alert("Please select the day");
r.Day.focus();
return;
}
//-----------------------------------------------------------------------
if(month=="Select Month")
{
alert("Please select the month");
r.Month.focus();
return;
}
//-----------------------------------------------------------------------
if(year.length==0)
{
alert("Please enter the year");
r.Year.focus();
}
else if (year.length!=4)
{
alert("Please enter the year in YYYY format");
r.Year.focus();
}
//-----------------------------------------------------------------------
if (( month == "3" || month == "5" || month == "8" || month == "10") && (day ==
"31"))
{
alert("Please enter a valid date");
r.Day.focus();
}
if ((month == "1") && (day == "30" || day == "31"))
{
alert("Please enter a valid date");
r.Day.focus();
}
//------- To check that online shopping system project report card date is not less
than current date----------
var vr_day;
var vr_month;
var vr_year;
var d=new Date();
vr_year=d.getFullYear();
vr_month=d.getMonth();
vr_day=d.getDate();
if(parseInt(vr_year)>parseInt(document.form1.Year.value))
{
alert("Year cannot be less than Current Year");
return false;
}
else if(parseInt(vr_year)==parseInt(document.form1.Year.value))
{
if(parseInt(vr_month)>parseInt(document.form1.Month.value))
{
alert("Month cannot be less than Current Month");
return false;
}
else if(parseInt(vr_month)==parseInt(document.form1.Month.value))
{
if(parseInt(vr_day)>parseInt(document.form1.Day.value))
{
alert("Day cannot be less than current Day");
return false;
}
}
}
//------------------------------------------------------------------------
document.form1.submit();
document.forms[0].action="Final.jsp";
}
</script>
<%
int counter=0;
counter=Integer.parseInt((String)session.getValue("TotalSel"));
String query="";
int[] bookid=new int[counter];
int[] bk_price=new int[counter];
int[] bk_quantity=new int[counter];
Connection conn;
conn=null;
ResultSet rs;
rs=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
PreparedStatement stat=null;
int ctr=0,bookprice=0;
int i=1;
while(i<=counter)
{
if((String)session.getValue("chk_var"+i)!=null)
{
bookid[i-
1]=Integer.parseInt((String)session.getValue("chk_var"+i));
rs=stat.executeQuery();
if(rs.next())
{
bk_price[i-1]=rs.getInt(1);
}
else
{
bk_price[i-1]=0;
}
}
if(request.getParameter("qty"+i)!=null)
{
bk_quantity[i-
1]=Integer.parseInt(request.getParameter("qty"+i));
String sess_var=String.valueOf(bk_quantity[i-1]);
session.putValue(sess_var,String.valueOf(bk_quantity[i-
1]));
}
bookprice=bookprice+(bk_price[i-1]*bk_quantity[i-1]);
i++;
}
session.putValue("bPrice",String.valueOf(bookprice));
%>
PreparedStatement stat1=null,stat_sel=null,stat_ins=null;
OrderID=(int)(10000*Math.random()+1);
price=Integer.parseInt((String)session.getValue("bPrice"));
int counter=0;
counter=Integer.parseInt((String)session.getValue("TotalSel"));
int[] bookid=new int[counter];
int[] bk_quantity=new int[counter];
int org_bkqty=0;
int i=0;
String ins_query="";
String sel_qtyQuery="";
String ins_qty="";
for(i=1;i<=counter;i++)
{
ResultSet rs_sql=null;
if((String)session.getValue("chk_var"+i)!=null)
{
bookid[i-
1]=Integer.parseInt((String)session.getValue("chk_var"+i));
}
if((String)session.getValue("bookqty"+i)!=null)
{
bk_quantity[i-
1]=Integer.parseInt((String)session.getValue("bookqty"+i));
}
ins_query="INSERT INTO ORDER_DETAILS VALUES(?,?,?)";
stat1=conn.prepareStatement(ins_query);
stat1.setInt(1,OrderID);
stat1.setInt(2,bookid[i-1]);
stat1.setInt(3,bk_quantity[i-1]);
int rs_int=0;
rs_int=stat1.executeUpdate();
sel_qtyQuery="SELECT QUANTITY FROM BOOK_DETAILS
WHERE BOOKID = ?";
stat_sel = conn.prepareStatement(sel_qtyQuery);
stat_sel.setInt(1,bookid[i-1]);
rs_sql=stat_sel.executeQuery();
if(rs_sql.next())
{
org_bkqty=rs_sql.getInt(1);
}
rs_sql.close();
String ns_qty="UPDATE BOOK_DETAILS SET QUANTITY=?
WHERE BOOKID=?";
stat_ins=conn.prepareStatement(ns_qty);
stat_ins.setInt(1,org_bkqty-bk_quantity[i-1]);
stat_ins.setInt(2,bookid[i-1]);
rs_int=stat_ins.executeUpdate();
}
}catch(Exception e){}
%>
<form name="newsrc" method="POST">
<BR><font size="3"><b>
Your order has been successfully placed.
<BR><BR>Order Number is : <%=OrderID%>
<BR><BR>Total Amount is : <%=price%>
<BR><BR>Date of Order is:
<%
out.println((new java.util.Date()).toLocaleString());
%>
<BR><BR>
Your Order will be delivered within next 48 working hours
<%
String card_no=request.getParameter("Card");
Connection con= null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
java.util.Date now = new java.util.Date();
DateFormat df1 = DateFormat.getDateInstance(DateFormat.SHORT);
String s1 = df1.format(now);
try
{
String str = "insert into order_table values(?,?,?,?)";
PreparedStatement stat= con.prepareStatement(str);
stat.setInt(1,OrderID);
stat.setString(2,user_src);
stat.setInt(3,price);
stat.setString(4,s1);
int x = stat.executeUpdate();
}catch(Exception e){out.println(e); }
}
else
{
response.sendRedirect("Unauthorised.htm");
}
%>
</body>
</html>
Administrator Modules
Admin.htm
<HTML>
<HEAD>
<TITLE>Administering Shopping Cart</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1>Administering Online Shopping Cart </H1>
</CENTER>
<br><hr><br><br>
<h2>Welcome Administrator</h2><br>
<Form name="admin" method="POST">
<TABLE width=100% border="0" cellpadding="2" cellspacing="0">
<TR>
<th align = "left" width="4%"></th>
<th align = "left" width="20%"></th>
<th align = "left" width="38%"></th>
<th align = "left" width="38%"></th>
</TR>
<TR>
<TH>1</TH>
<TH align = "left">Book</TH>
<TH><a href="Insert.jsp">Insert New Book Details</a></TH>
<TH><a href="Modify.jsp">Modify Book Details</a></TH>
</TR>
<TR>
<TH>2</TH>
<TH align = "left">Category</TH>
<TH><a href="Insert_Category.jsp">Insert Book Category</a></TH>
<TH><a href="Update_Category.jsp">Modify Book Category</a></TH>
</TR>
</BODY>
</HTML>
Insert.jsp
<HTML>
<HEAD>
<TITLE>Insert New Book</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1> <u>Administering Online Shopping Cart</u> </H1>
<H2> Add Book</H2>
</CENTER>
<BR>
<HR>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
<BODY bgcolor="#CCFFFF">
<SCRIPT language="Javascript">
function check()
{
var ctr=0;
if(document.addbook.title.value=="")
{
alert("Please Enter Title");
return;
}
if(document.addbook.author.value=="")
{
alert("Please Enter Author");
return;
}
if(document.addbook.pub.value=="")
{
alert("Please Enter Publisher Name");
return;
}
if(document.addbook.edition.value=="")
{
alert("Please Enter Edition");
return;
}
if(document.addbook.price.value=="")
{
alert("Please Enter Price (in Rs.)");
return;
}
if(document.addbook.qty.value=="")
{
alert("Please Enter Quantity");
return;
}
if(document.addbook.desc.value=="")
{
alert("Please Enter Description");
return;
}
if(isNaN(document.addbook.price.value))
{
alert("Please Enter a numeric value for Price (in Rs.)");
ctr=1;
}
if(isNaN(document.addbook.qty.value))
{
alert("Please Enter a numeric value for Quantity");
ctr=1;
}
if(ctr==0)
{
document.forms[0].action="AddBook.jsp";
document.forms[0].submit();
}
else
{
return true;
};
</SCRIPT>
<%@ page errorPage="errorpage.jsp" import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
Connection con = null;
//Statement stat = null;
PreparedStatement stat = null;
//Statement stat1 = null;
PreparedStatement stat1 = null;
ResultSet rs = null;
ResultSet rs1 = null;
String query=null;
String query1=null;
int ctr=0, flag=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
query="Select a.*,b.categoryname from book_details a, category_details b where
a.categoryid=b.categoryid";
query1="select * from category_details";
stat = con.prepareStatement(query);
stat1 = con.prepareStatement(query1);
rs=stat.executeQuery();
rs1=stat1.executeQuery();
%>
<br><h3>List of Available Books:</h3>
<table border=1>
<tr>
<td>S.No</td>
<td>Book Id</td>
<td>Book Name</td>
<td>Author Name</td>
<td>Publisher</td>
<td>Edition</td>
<td>Price (in Rs.)</td>
<td>Quantity Available(Nos.)</td>
<td>Description</td>
<td>Category</td>
</tr>
<%
int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY;
String
str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION;
while(rs.next())
{
ctr=ctr+1;
out.println("<tr><td>"+ctr);
int_BOOKID=rs.getInt(1);
out.println("<td>");
out.println(int_BOOKID);
int_CATEGORYID=rs.getInt(2);
str_TITLE=rs.getString(3);
out.println("<td>");
out.println(str_TITLE);
str_AUTHOR=rs.getString(4);
out.println("<td>");
out.println(str_AUTHOR);
str_PUBLISHER=rs.getString(5);
out.println("<td>");
out.println(str_PUBLISHER);
str_EDITION=rs.getString(6);
out.println("<td>");
out.println(str_EDITION);
int_PRICE=rs.getInt(7);
out.println("<td>");
out.println(int_PRICE);
int_QUANTITY=rs.getInt(8);
out.println("<td>");
out.println(int_QUANTITY);
str_DESCRIPTION=rs.getString(9);
out.println("<td>");
out.println(str_DESCRIPTION);
out.println("<td>");
out.println(rs.getString(10));
out.println("</tr>");
}
out.println("</table>");%>
<br>
<hr>
<h3> Add New Book Details</h3>
<form name="addbook">
<table border=1>
<tr><td>Book Title</td><td><input type="text" name="title"></td>
<tr><td>Author Name</td><td><input type="text" name="author"></td>
<tr><td>Publisher</td><td><input type="text" name="pub"></td>
<tr><td>Edition</td><td><input type="text" name="edition"></td>
<tr><td>Price (in Rs.)</td><td><input type="text" name="price"></td>
<tr><td>Quantity Available(Nos.)</td><td><input type="text"
name="qty"></td>
<tr><td>Description</td><td><input type="text" name="desc"></td>
<tr><td>Category</td><td><select size="1" name="cat">
<%
while(rs1.next())
{%>
<option value="<%=rs1.getString(1)%>"><
%=rs1.getString(2)%></option>
<%}%>
</select></td>
</tr>
<tr><td><input type="submit" value=" Add "
onClick="check();"></td>
<td><input type="Reset" value=" Clear "></td>
</table>
</form>
<%
}
catch(Exception e)
{
out.print("Error = " + e + "<HR>");
}
%>
</BODY>
</HTML>
Modify.jsp
<HTML>
<HEAD>
<TITLE>Modify Book Details</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2>Modify Book Details</H2>
</CENTER>
<BR>
<HR>
<BR>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
ResultSet rs = null;
String query=null;
int ctr=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
rs=stat.executeQuery();
%>
<br><h3>List of Available Books:</h3>
<form name="Mod" action="Modify_Book.jsp">
<table border=1>
<tr>
<td>S.No</td>
<td>Book Id</td>
<td>Book Name</td>
<td>Author Name</td>
<td>Publisher</td>
<td>Edition</td>
<td>Price (in Rs.)</td>
<td>Quantity Available(Nos.)</td>
<td>Description</td>
<td>Category</td>
</tr>
<%
int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY;
String
str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION;
while(rs.next())
{
ctr=ctr+1;
out.println("<tr><td>"+ctr);
int_BOOKID=rs.getInt(1);
out.println("<td>");
out.println("<input type=radio name=R1
value="+int_BOOKID+">");
int_CATEGORYID=rs.getInt(2);
str_TITLE=rs.getString(3);
out.println("<td>");
out.println(str_TITLE);
str_AUTHOR=rs.getString(4);
out.println("<td>");
out.println(str_AUTHOR);
str_PUBLISHER=rs.getString(5);
out.println("<td>");
out.println(str_PUBLISHER);
str_EDITION=rs.getString(6);
out.println("<td>");
out.println(str_EDITION);
int_PRICE=rs.getInt(7);
out.println("<td>");
out.println(int_PRICE);
int_QUANTITY=rs.getInt(8);
out.println("<td>");
out.println(int_QUANTITY);
str_DESCRIPTION=rs.getString(9);
out.println("<td>");
out.println(str_DESCRIPTION);
out.println("<td>");
out.println(rs.getString(10));
out.println("</tr>");
}
%>
<tr>
<td><input type="submit" value=" Modify "></td>
<td><input type="Reset" value=" Clear "></td>
</tr>
</table>
</form>
<%
}
catch(Exception e)
{
out.print("Error = " + e + "<HR>");
}
%>
</BODY>
</HTML>
AddBook.jsp
<HTML>
<HEAD>
<TITLE>Insert New Book</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2>Add Book</H2>
</CENTER>
<BR>
<HR>
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
int rs;
String query=null;
String query1=null;
String TITLE;
TITLE=request.getParameter("title");
query1="Select a.* from book_details a where a.title=?";
PreparedStatement stat1= con.prepareStatement(query1);
stat1.setString(1,TITLE);
rs1=stat1.executeQuery();
if(rs1.next())
{
%>
<SCRIPT language="JavaScript">
alert("This online shopping system project book already exists.");
location.href="Insert.jsp";
</SCRIPT>
<%
}
else
{
int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY;
String
str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION;
int_BOOKID=(int)(10000*Math.random()+1);
int_CATEGORYID=Integer.parseInt(request.getParameter("cat"));
str_TITLE=request.getParameter("title");
str_AUTHOR=request.getParameter("author");
str_PUBLISHER=request.getParameter("pub");
str_EDITION=request.getParameter("edition");
int_PRICE=Integer.parseInt(request.getParameter("price"));
int_QUANTITY=Integer.parseInt(request.getParameter("qty"));
str_DESCRIPTION=request.getParameter("desc");
query="insert into book_details values (?,?,?,?,?,?,?,?,?)";
stat = con.prepareStatement(query);
stat.setInt(1,int_BOOKID);
stat.setInt(2,int_CATEGORYID);
stat.setString(3,str_TITLE);
stat.setString(4,str_AUTHOR);
stat.setString(5,str_PUBLISHER);
stat.setString(6,str_EDITION);
stat.setInt(7,int_PRICE);
stat.setInt(8,int_QUANTITY);
stat.setString(9,str_DESCRIPTION);
rs=stat.executeUpdate();
if(rs==1)
{%>
<BR>
<H3>Successfully inserted the data.</H3>
<% }
else
{%>
<BR>
<H3>Could not add the book</H3>
<%}
}%>
<BR>
<a href="Logout.jsp">Click here to logout</a>
<BR><BR>
<a href="Admin.htm">Click here to go to administrator page</a>
<BR><BR>
<a href="Insert.jsp"> Click here to add more books</a>
</BODY>
</HTML>
Modify_Book.jsp
<HTML>
<HEAD>
<TITLE>Modify Book</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2>Modify Book Details</H2>
</CENTER>
<HR>
<BR>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
stat = con.prepareStatement(query);
stat.setInt(1,book_sel);
rs=stat.executeQuery();
if(rs.next())
{
%>
<br><h3>Details of Selected Book:</h3>
<form name="Mod" action="Final_Mod_Book.jsp">
<input type="hidden" name="categoryid" value="<
%=rs.getString(2)%>">
<table border=1>
<tr>
<td>Book Id</td><td><input type="hidden" name="bookid" value="<
%=book_sel%>"><%=book_sel%> </td></tr>
<tr>
<td>Book Name</td><td><input type="text" name="btitle" value=<
%=rs.getString(3)%>></td>
</tr><tr>
<td>Author Name</td><td><input type="text" name="bauthor" value=<
%=rs.getString(4)%>></td>
</tr><tr>
<td>Publisher</td><td><input type="text" name="bpub" value=<
%=rs.getString(5)%>></td>
</tr><tr>
<td>Edition</td><td><input type="text" name="bedition" value=<
%=rs.getString(6)%>></td>
</tr><tr>
<td>Price (in Rs.)</td><td><input type="text" name="bprice" value=<
%=rs.getString(7)%>></td>
</tr><tr>
<td>Quantity Available(Nos.)</td><td><input type="text" name="bqty"
value=<%=rs.getString(8)%>></td>
</tr><tr>
<td>Description</td><td><input type="text" name="bdesc" value=<
%=rs.getString(9)%>></td>
</tr><tr>
<td>Category</td><td><input type="text" name="bcat" value=<
%=rs.getString(10)%>></td>
</tr><tr>
<tr><td><input type="submit" value=" Save Changes "></td><td><input
type="Reset" value=" Clear "></td></tr>
</table>
</form>
<%
}
}
catch(Exception e)
{
out.print("Error = " + e + "<HR>");
}
%>
</BODY>
</HTML>
Final_mod_Book.jsp
<HTML>
<HEAD>
<TITLE>Book Details Modified</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2>Book Details Modified</H2>
</CENTER>
<BR>
<HR>
<BR>
<BR>
<%@ page errorPage="errorpage.jsp" import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
Connection con = null;
//Statement stat = null;
PreparedStatement stat = null;
//Statement stat1 = null;
PreparedStatement stat1 = null;
ResultSet rs = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
int rs_int;
int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY;
String query=null;
String
str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION;
int_BOOKID=Integer.parseInt(request.getParameter("bookid"));
int_CATEGORYID=Integer.parseInt(request.getParameter("categoryid"));
str_TITLE=request.getParameter("btitle");
str_AUTHOR=request.getParameter("bauthor");
str_PUBLISHER=request.getParameter("bpub");
str_EDITION=request.getParameter("bedition");
int_PRICE=Integer.parseInt(request.getParameter("bprice"));
int_QUANTITY=Integer.parseInt(request.getParameter("bqty"));
str_DESCRIPTION=request.getParameter("bdesc");
rs_int=stat.executeUpdate();
if (rs_int==1)
{
out.println("Book details for Book Id "+int_BOOKID+"
successfully modified.");
}
else
{
out.println("Sorry Transaction not Completed");
}
%>
<BR><BR>
<a href="Logout.jsp">Click here to logout</a>
<BR><BR>
<a href="Admin.htm">Click here to go to administrator page</a>
<BR><BR>
<a href="Modify.jsp"> Click here to modify more books</a>
</BODY>
</HTML>
Insert_Category.jsp
<HTML>
<HEAD>
<TITLE>Insert New Category</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2> Add Category</H2>
</CENTER>
<BR>
<HR>
<BR>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
rs=stat.executeQuery();
%>
<br><h3>Add New Category:</h3>
<form name="addbook" action="AddCategory.jsp">
<table border=1>
<tr>
<td>Categories Available</td>
<td><select size="1" name="cat">
<%
while(rs.next())
{%>
<option value="<%=rs.getString(1)%>"><
%=rs.getString(2)%></option>
<%}%>
</select></td>
</tr>
<tr>
<td>Category to be added</td>
<td><input type="text" name="cat_name"></td></tr>
<tr><td><input type="submit" value=" Add "></td><td><input
type="Reset" value=" Clear "></td>
</table></form>
<%
}
catch(Exception e)
{
out.print("Error = " + e + "<HR>");
}
finally
{
rs.close();
con.close();
}
%>
</BODY>
</HTML>
Update_Category.jsp
<HTML>
<HEAD>
<TITLE>Category Modified</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2>Category Modified</H2>
</CENTER>
<BR>
<HR>
<BR>
<a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a>
<BR><BR>
<script language="Javascript">
function sel_click()
{
var f = document.modcat;
var i=f.cat.selectedIndex;
var str=f.cat.options[i].text;
document.modcat.vr_cat.value=str;
document.modcat.cat_val.value=document.modcat.elements[0].value;
}
</script>
rs=stat.executeQuery();
%>
<br><h2>Modify Category:--</h2>
<form name="modcat" action="ModifyCategory.jsp">
<table border=1>
<tr>
<td>Category</td>
<td><select size="1" name="cat" onChange="sel_click();">
<%
while(rs.next())
{%>
<option value="<%=rs.getString(1)%>">
<%=rs.getString(2)%></option>
<%}%>
</select></td>
</tr>
<tr><td colspan=2><input type="text" name="vr_cat"><input type="text"
name="cat_val"></td>
<tr><td><input type="submit" value=" Modify "></td><td><input
type="Reset" value=" Clear "></td>
</table></form>
<%
}
catch(Exception e)
{
// out.print("Error = " + e + "<HR>");
}
finally
{
rs.close();
con.close();
}
%>
</BODY>
</HTML>
ModifyCategory.jsp
<HTML>
<HEAD>
<TITLE>Modify Category</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
</CENTER>
<BR>
<HR>
<BR>
<BR>
<%@ page errorPage="errorpage.jsp" import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
Connection con = null;
PreparedStatement stat = null;
int rs = 0;
String query=null;
try
{
String new_cat="";
int cat_id=0;
new_cat=request.getParameter("vr_cat");
cat_id=Integer.parseInt(request.getParameter("cat_val"));
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Data","scott","tiger");
stat = con.prepareStatement(query);
stat.setString(1,new_cat);
stat.setInt(2,cat_id);
rs=stat.executeUpdate();
if (rs==1)
{
out.println("Category Successfully Modified");
}
else
{
out.println("Transaction Not Allowed");
}
}
catch(Exception e)
{
out.print("Error = " + e + "<HR>");
}
finally
{
con.close();
}
%>
<BR>
<BR>
<a href="Logout.jsp">Click here to logout</a>
<BR><BR>
<a href="Admin.htm">Click here to go to administrator page</a>
<BR><BR>
<a href="Update_Category.jsp"> Click here to modify more
categories</a>
</BODY>
</HTML>
AddCategory.jsp
<HTML>
<HEAD>
<TITLE>Insert New Category</TITLE>
</HEAD>
<BODY bgcolor="#CCFFFF">
<CENTER>
<H1> Administering Online Shopping Cart </H1>
<H2> Add Category</H2>
</CENTER>
<BR>
<HR>
<BR>
int rs;
int int_CATEGORYID;
String query=null;
String str_CATEGORY;
int_CATEGORYID=(int)(10000*Math.random()+1);
str_CATEGORY=request.getParameter("cat_name");
End of Coding
User Interface
Admin Interface
End of Output
7.1Testing
Software testing is a critical element of software quality assurance and represents the
ultimate review of specification, design and code generation. The increasing visibility of
software as a system element and the attendant “costs” associated with a software
failure are motivating forces for well planned through testing.
Once source code has been generated, software must be tested to uncover as many
errors as possible before delivery to customer. The goal is to design a series of test
cases that online shopping system project report have a high likelihood of finding errors
but how? That online shopping system project report’ where software testing techniques
enter the pictures.
Unit testing focuses verification effort on the smallest unit of software design-the software
component or module. Using the component – level design description as a guide, important
control paths are tested to uncover errors within the boundary of the module. The relative
complexity of tests and uncovered errors is limited by the constrained scope established for
unit testing. The unit test is white-box oriented and the step can be conducted in parallel for
multiple components.
Login Module:
Expecte
Sr. Test Case Observed Test
Input d
No Description behavior Result
Behavior
Is Database Connection Connection No error during
1 Connection object is establishe connection was Success
establishing? created s found
Observe
Sr. Test Case Expected Test
Input d
No Description Behavior Result
behavior
Client Server Connecti Connection Connection is
1 Success
Connection on cmd established established
Server Proper All type of
response Login Message messages are
2 handled displayed in Success
cmd Displayed to
properly or User proper format to
not? user
Login cmd is
Communicatio
received by
n between Login Communication is
3 server and Success
client and cmd taking place.
response is
server
send to client
Server should
What if User Login
report non Error msg: "Login
4 Id doesn't cmd+ Success
existence of ID doesn't exist"
exist UserlD
UserlD
What if Login cmd+ User should Error msg:
5 wrong UserID+ be prompt for "Invalid Success
password is Password reentry of Password
entered? password "
Add Record Module:
Sr
Test Case Expected Observed Test
. Input
Description Behavior behavior Result
N
Is Database Connection No error during
Connection
1. Connection object is connection was Success
establishes
establishing? created found
Book
Addition Addition Success
2 Addition of Books. Name/Author/
Completed. completed
Stock/Edition
Addition is not
Book Addition
Addition of Books if completed,
3 Name/Author/ should not Success
already exits because record
Stock/Edition complete
already exists.
Sr
Test Case Expected Observed Test
. Input
Description Behavior behavior Result
N
Is Database No error during
Connection Connection
1. Connection connection was Success
object is created establishes
establishing? found
On search Criteria
of Book
Result
2 Title/Publisher/Editi Name/Author/Sto Result found. Success
found.
on should come in ck/Edition
list box
7.1.4 Integration Testing
Integration testing is a systematic technique for constructing the program structure while at the
same time conducting tests to uncover errors associated with interfacing. The objective is to
take unit tested components and build a program structure that online shopping system project
report has been dictated by design.
Incremental integration is the antithesis of the big bang approach. The program is constructed
and tested in small increments, where errors are easier to isolate and correct, interfaces are
more likely to be tested completely, and a systematic test approach may be applied.
Sr
Test Case Expected Observed Test
N Input
Description Behavior behavior Result
o
User should be
Login ID
Is new User created and personal User named
1 +personal Success
created? information should be ID is created.
information
stored in Database
No error
Is Database Connection
Connection during
2 Connection object is Success
establishes connection
establishing? created
was found
Is able to match Login Id
Matching
3 Login ID & +Pass- Proper matching Success
done
Password word
Does status of
No change in
4 user changes to Logout cmd Status should change. Success
status
'Logout status’?
14 Add Record Module, Delete Record Module, Update Record Module, Search
Record Module is Integrated
Sr
Test Case Expected Observed Test
N Input
Description Behavior behavior Result
o
BookName/ Records should
Is new Record Record is added
Author be added and
1 Added in and displayed on Success
Name/Editio displayed on
database? the view page.
n etc the view page
BookName/ Records should
Is existing be deleted and Record is deleted
Author
2 Record deleted should not be and not displayed Success
Name/Editio
from database? displayed on on the view page.
n etc
the view page
Records should
Is existing BookName/ Record is
be updated and
Record Author updated and
3 should be Success
updated into Name/Editio displayed on the
displayed on the
database? n etc view page.
view page
On search BookName/
Records should Records found and
Criteria names Author
4 be displayed on displayed on the Success
should be Name/Editio
the view page view page.
correct. n etc
7.1.5 System Testing
System testing is actually a series of different tests whose primary purpose is to fully
exercise the computer-based system. Although each test has a different purpose, all
work to verify that online shopping system project report system elements have been
properly integrated and perform allocated functions.
Functional Requirements
Sr
Test Case Expected Observed
.N Input Test Result
Description Behavior behavior
o
User should User is Registered
Can New User Personal Info Be registered only If desired Id
1 Success
Register? of User on DTIS does Not collide
server with Existing Ids
User should
Click On
8 Can User Logout be able to Logout Message Success
Logout
Logout
7.1.6 OPTIMIZATION POINTS
The software will work efficiently and speedily when the following conditions will be
satisfied:
There are some limitations for the current system to which solutions can be provided as a
future development:
1. The system is not configured for multi- users at this online shopping system
project time. The concept of transaction can be used to achieve this online
shopping system project.
2. The Website is not accessible to everyone. It can be deployed on a web server so
that online shopping system project report everybody who is connected to the
Internet can use it.
3. Credit Card validation is not done. Third party proprietary software can be used
for validation check.
1. The Administrator of the web site can be given more functionalities, like
looking at a specific customer’s profile, the books that online shopping
system project report have to be reordered, etc.
2. Multiple Shopping carts can be allowed.
8.1. Conclusion
The Internet has become a major resource in modern business, thus electronic shopping
has gained significance not only from the entrepreneur’s but also from the customer’s
point of view. For the entrepreneur, electronic shopping generates new business
opportunities and for the customer, it makes comparative shopping possible. As per a
survey, most consumers of online stores are impulsive and usually make a decision to
stay on a site within the first few seconds. “Website design is like a shop interior. If the
shop looks poor or like hundreds of other shops the customer is most likely to skip to the
other site. Hence we have designed the project to provide the user with easy navigation,
retrieval of data and necessary feedback as much as possible.
In this online shopping system project project, the user is provided with an e-commerce
web site that online shopping system project report can be used
to buy books online. To implement this online shopping system project as a web
application we used JSP as the
Technology. JSP has several advantages such as enhanced performance, scalability, built-
in security and simplicity. To build any web application using JSP we need a
Programming language such as Java and JSP so on. was the language used to build this
online shopping system project application. For the client browser to connect to the JSP
engine we used Tomcat web server.
JSP uses JDBC to interact with the database as it provides in-memory caching that online
shopping system project report eliminates the need to contact the database server
frequently and it can easily deploy
and maintain an JSP application. Oracle was used as back-end database since it is one of
the most popular commercial databases, and it provides fast data access, easy installation
and simplicity.
A good shopping cart design must be accompanied with user-friendly shopping cart
application logic. It should be convenient for the customer to view the contents of their
cart and to be able to remove or add items to their cart. The shopping cart application
described in this online shopping system project project provides a number of features
that online shopping system project report are designed to make the customer more
comfortable.
This online shopping system project project helps in understanding the creation of an
interactive web page and
the technologies used to implement it. The design of the project which includes Data
Model and Process Model illustrates how the database is built with different tables, how
the data is accessed and processed from the tables. The building of the project has given
me a precise knowledge about how JSP is used to develop a website, how it connects to
the database to access the data and how the data and web pages are modified to provide
the user with a shopping cart application.
9Bibliography
91 References
www.google.com
www.wrox.com
www.java.sun.com
www.oracle.com