Professional Documents
Culture Documents
\
Declaration
I declare that the work which is being presented in this thesis entitled “Alpha BookStore” is
authentic record of my work carried out under the guidance of Mr. Ram kumar Assistant
Professor (CSE). The matter embodied in this report has not been submitted to any other
University/ Institute for the award of any degree or diploma. I have followed all the
guidelines provided to me by the Institute in writing this thesis. I have also conformed to the
norms and guidelines given in the Ethical Code of Conduct of the Institute. Whenever I have
used materials (data, theoretical analysis, and text) from other sources, I have given due
credit to them by citing them in the text of the thesis and giving their details in the references.
KULDEEP TOMAR
Department of Computer Science and Engineering
International Institute of Technology & Management
2
Certificate
This is to certify that the work in this thesis entitled “Alpha BookStore” submitted by Mr.
KULDEEP TOMAR in partial fulfillment of the requirements for the award of degree of
Master of Technology in Computer Science is an authentic work carried out by him under my
guidance and supervision at the Department of Computer Science Engineering , International
Institute of Technology & Management , Murthal , Sonepat.
Acknowledgments
3
First of all I am thankful to almighty GOD to help me out in every odds and buts. There are
numerous people without whom this dissertation might never have been completed. Among
those who deserve credit and our heartfelt gratitude is the most important Mr. Ramkumar for
his valuable guidance and support. Without him this work would not have been possible. I am
also thankful Mrs. Neha Kaushik for their constant encouragement and guidance. Last but
not the least I would like to thank the faculty members of the Department of Computer
Science Engineering for being very supportive to me throughout these years. I am also
thankful to my friends and classmates for their valuable suggestions.
KULDEEP TOAMR
14015001007
Abstract
After the years of stagnation, there are indications that the typical “Indian Consumer” has
finally come online for not most, but at least few sectors of online purchases of items some
4
including books and even more. This case study is to build a web site to sell the books over a
finite geographical area.
Since Internet technology is rapidly improving, more and more people are using the Internet
for their business growth and cost reduction in order to achieve their business goals. Business
consumers want more convenient and straightforward access to Web applications. There are
many technologies that can be used to build Web services and Web applications. This web
application does implement the technologies provided by Java namely JSPs, JSTL, Servlets
and Java Beans.
This application allows users to register online, make purchases online, and track the order
and shipping status online. It stores the persistent data into Xampp database and uses Java
Database Connectivity (JDBC) to manipulate the data through calls made by the JDBC from
the Web Application. The application was built using the current latest web standards. The
services were designed using Java as its core programming for its business logics, while the
presentational part was been done on varied technologies some including Ajax with jQuery,
CSS3, and HTML5. The statistical reports were been designed and presented with Google
charts API. For the most of the application’s part, the images and resources were only used
when it was in a real need to have its presence to signify the item, while the rest of the
presentation was done using Cascading Style Sheets. It seems varied and different streams of
information meet together, when we in particular create something out of it. Here we see the
structural Knowledge Management and Statistics moving hand in hand with Computing and
Logical Reasoning.
Table of Contents
Declaration........................................................................................ii
Certificate......................................................................................... iii
Acknowledgement............................................................................ iv
5
Abstract............................................................................................. v
List of Figures................................................................................. ix
List of Tables....................................................................................x
Chapter 1 Introduction
1.1
Overview.................................................................................................
....1
1.2 Problem
Statement......................................................................................1
1.3 Motivation of the
Work...............................................................................2
1.4
Approach.................................................................................................
....2
1.5 Thesis
Organization.....................................................................................3
Chapter 2 Chapter name
Chapter 3
List of Figures
3.1Name of
Figure1.................................................................................................9
4.1Name of
Figure2…………...............................................................................17
6.1...........................................................................................................
...............25
6.2...........................................................................................................
................24
List of Tables
7
2.1 Name of
table1.......................................................................................................
...23
2.2 Name of
table2.......................................................................................................
...25
5.1
………………………………................................................................
..................26
8
9
Chapter 1
Introduction
ORGANIZATION OVERVIEW
College Books
ADDRESS:
TELEPHONE No. :
8467878250
HISTORY
This is project for applying and for checking our knowledge so there is no history of this and
address its just a web application through which we show our skills .
Problem Statement
At present the work is currently been processed through all the papers and registers, every
possible data entry has to be done in the registers every day after the shop has been closed. Here
all the records of the items sold, purchased, are maintained by separate registers. Keeping track
of the members who are on credit balance and credit purchases are been done in separate
registers as well which is time consuming process.
There is a separate track of records been maintained in a separate register for all those dealers
and merchants who provide goods and/or services to them. The entire process is done all
throughout the monthly basis and finally a record is kept track for all those products which were
sold as per user’s requirements and a track of all those products help them to make their next
orders on safer side.
After the records have been tracked each month, Every month is been compared to the sales,
purchases and businesses of the previous months, this helps them to keep records on the future
gains and the development of their business.
Goods once purchased are kept aside for thorough checking process for any defects/counterfeit,
Once done are kept at their respective categorized places and checked regularly
Goods Sold are kept records every night before closing time for their appropriate buying
decisions from dealer next time
Every month a transaction process is record which gives the owner the track of their current
gains in their business.
2. The system is manual thus it does not provide a graphical user interface.
3. Needs more space for maintenance , the current system is very time consuming.
4. It is very difficult to search the detail of a customer or the event detail for anyone unless
6. It creates confusion and makes it difficult to find the details of the customer. Many a times
7. This type of working system increases the workload of the person who is looking after these
diaries.
8. Due to calculations error in the bill may lead to loss either to dealers or customers.
Sometimes it may lead to quarrel between dealers & customers.
3
1. The proposed automated system will be a database comprising of brief compact, systematic
organization of the information which are currently recorded and may be redundant in nature.
2. System will be website based, user friendly and efficient, so that even a non‐technical user
can use the system without any difficulty.
3. The proposed system will be computerized system, so this system will not be time
consuming.
4. Appropriate master tables must be present so that user will be able to find any kind of records
and details.
5. Security will be maintained in this system. No one will be able to see the undesired data
unless the administrator permits him.
Bill generation.
Selling detail report
Purchases Registration report(Customer wise)
APPROACH
4
For the system requirements and the success of this project, stakeholders of the system are:
2. Technical staff:
Kuldeep Tomar
3. End users:
The end‐users of the organization are divided into these sub category :
Operational Staff
The operational staff of the current system is none other than the owner himself.
Middle Management
The query requirement and the summary reports are handled by the owner of the company.
Top Management
The management of the company and the strategic issues are handled by the owner.
End Users
Any user who needs to have an access the application from a remote computer to order and view
the available product is categorized as an end user, Or an administrator who wants to view the
data for the application may referred to as end user.
5
The data centric application will prove to be beneficial as compared to the cost being developed,
once installed. The system being developed must have the following requirements in order for a
successful run on a production environment.
System Requirements
If the stakeholder does not wants to have his application to be online then he might not need a
domain name, While If he is interested in having his store online then he might consider it to
have a domain name and/or a hired J2EE web server.
Otherwise if he is interested in having a server at his workspace then it may not be a tideous task
for him to configure it.
ARCHITECTURE USED
Hardware Used:
RAM: 8GB
Software Used:
OS : Window 10
6
Chapter 2
Everything is recorded manually onto books or paper, Expenses being done in registers and thus
finally records are currently saved manually, no automation.
We deal in every item that deal in paper product and a few movies as well as games collections.
3) Are you interested in having software that will publish your products online or in other words
do you want to be a Web Merchant?
After the success story of Flipkart, Homeshop18, PrimeABGB, and many online megastores
even I am interested in being a web merchant that will just increase my sales just double and will
lead to greater revenue.
Firstly we have a varied stock of category, namely the major products are categorized as follows,
we have books, movies games, and little elementary electronics. Now these major categories are
then classified into minor sub‐categories, take the example of here a book, A book may be a
single lined book, a double lined book, a school textbooks, novels, Or an another example will
be a Game, which has a minor sub‐category of Action Game, Adventure Game, First Person
Shooting (FPS) Games, Simulation Games, Open World Games, Sports Games, etc. Even
Electronics are been classified into Laptops, Graphics Cards, Motherboards, etc. We even have
our co partners for us to have sales
5) Will you deal with courier system if the system will be online?
7
Definitely, if the sales given online may be of a value, We may not have any issues in having the
product delivered to the consumer, Provided that the verification of the address proof ad the
consumer will be done beforehand.
6) How will and till what range will you considered to have couriered?
As of now, We need courier system till the range of only a diameter of the entire Mumbai and
Thane district, because we need not want counterfeit in credit cards as we even had not being
using credit/debit cards for online purchases
7) Would you like to have reporting and monitoring system that may handle your tasks and keep
an eye over your sales and purchases?
That will definitely be an added advantage over us ‘cause we currently do not have one
8
Chapter 3
INTRODUCTION
In this project the tools and technology we have used are as follows:
Java
NetBeans IDE
Servlet
Jsp
JDBC
Xampp
MY SQL
History of java:
Java language was developed by James Gosling and his team at sun micro systems and released
formally in 1995. Its former name is oak. Java Development Kit 1.0 was released in 1996. Java
is a programming language and a platform.Java is a high level, robust, secured and object-
oriented programming language.
Where it is used?
According to Sun, 3 billion devices run java. There are many devices where Java is currently
used. Some of them are as follows:
9
1. Desktop Applications such as acrobat reader, media player, antivirus etc.
4. Mobile
5. Embedded System
6. Smart Card
7. Robotics
8. Games etc.
It is a java programming platform. It includes Java programming APIs such as java.lang, java.io,
java.net, java.util, java.sql, java.math etc. It includes core topics like OOPs, String, Regex,
Exception, Inner classes, Multithreading, I/O Stream, Networking, AWT, Swing, Reflection,
Collection etc.
It is an enterprise platform which is mainly used to develop web and enterprise applications. It is
built on the top of Java SE platform. It includes topics like Servlet, JSP, Web Services, EJB, JPA
etc.
It is used to develop rich internet applications. It uses light-weight user interface API.
Features of Java
There is given many features of java. They are also known as java buzzwords. The Java Features
given below are simple and easy to understand.
1. Simple
2. Object-Oriented
3. Portable
4. Platform independent
5. Secured
6. Robust
7. Architecture neutral
8. Dynamic
11
9. Interpreted
11. Multithreaded
12. Distributed
Simple
Syntax is based on C++ (so easier for programmers to learn it after C++).
Removed many confusing and/or rarely-used features e.g., explicit pointers, operator
overloading etc.
Object-oriented
1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
12
6. Encapsulation
Platform Independent
There are two types of platforms software-based and hardware-based. Java provides software-
based platform.
The Java platform differs from most other platforms in the sense that it is a software-based
platform that runs on the top of other hardware-based platforms. It has two components:
1. Runtime Environment
13
Java code can be run on multiple platforms e.g. Windows, Linux, Sun Solaris, Mac/OS etc. Java
code is compiled by the compiler and converted into bytecode. This bytecode is a platform-
independent code because it can be run on multiple platforms i.e. Write Once and Run
Anywhere(WORA).
Secured
o No explicit pointer
o Classloader: adds security by separating the package for the classes of the local file
system from those that are imported from network sources.
o Bytecode Verifier: checks the code fragments for illegal code that can violate access
right to objects.
o Security Manager: determines what resources a class can access such as reading and
writing to the local disk.
These security are provided by java language. Some security can also be provided by application
developer through SSL, JAAS, Cryptography etc.
14
Robust
Robust simply means strong. Java uses strong memory management. There are lack of pointers
that avoids security problem. There is automatic garbage collection in java. There is exception
handling and type checking mechanism in java. All these points makes java robust.
Architecture-neutral
In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes
of memory for 64-bit architecture. But in java, it occupies 4 bytes of memory for both 32 and 64
bit architectures.
Portable
High-performance
Java is faster than traditional interpretation since byte code is "close" to native code still
somewhat slower than a compiled language (e.g., C++)
Distributed
We can create distributed applications in java. RMI and EJB are used for creating distributed
applications. We may access files by calling the methods from any machine on the internet.
Multi-threaded
A thread is like a separate program, executing concurrently. We can write Java programs that
deal with many tasks at once by defining multiple threads. The main advantage of multi-
15
threading is that it doesn't occupy memory for each thread. It shares a common memory area.
Threads are important for multi-media, Web applications etc.
NETBEANS IDE
The NetBeans IDE is primarily intended for development in Java, but also supports other
languages, in particular PHP, C/C++ and HTML5.
NetBeans is cross-platform and runs on Microsoft Windows, Mac OS X, Linux, Solaris and other
platforms supporting a compatible JVM
The NetBeans Team actively support the product and seek feature suggestions from the wider
community. Every release is preceded by a time for Community testing and feedback.
16
Overview of Servlet technology
Servlet:
Servlet technology is used to create web application (resides at server side and generates
dynamic web page).
Servlet technology is robust and scalable because of java language. Before Servlet, CGI
(Common Gateway Interface) scripting language was popular as a server-side programming
language. But there was many disadvantages of this technology. We have discussed these
disadvantages below.
There are many interfaces and classes in the servlet API such as Servlet, GenericServlet,
HttpServlet, ServletRequest, ServletResponse etc.
Features of Servlet
o Servlet is an API that provides many interfaces and classes including documentations.
o Servlet is a class that extend the capabilities of the servers and respond to the incoming request. It
can respond to any type of requests.
o Servlet is a web component that is deployed on the server to create dynamic web page.
17
Overview of JSP technology
JSP:
JSP technology is used to create web application just like Servlet technology. It can be thought
of as an extension to servlet because it provides more functionality than servlet such as
expression language, jstl etc.
A JSP page consists of HTML tags and JSP tags. The jsp pages are easier to maintain than servlet
because we can separate designing and development. It provides some additional features such as
Expression Language, Custom Tag etc.
There are many advantages of JSP over servlet. They are as follows:
1) Extension to Servlet
JSP technology is the extension to servlet technology. We can use all the features of servlet in
JSP. In addition to, we can use implicit objects, predefined tags, expression language and Custom
tags in JSP, that makes JSP development easy.
2) Easy to maintain
JSP can be easily managed because we can easily separate our business logic with presentation
logic. In servlet technology, we mix our business logic with the presentation logic.
If JSP page is modified, we don't need to recompile and redeploy the project. The servlet code
needs to be updated and recompiled if we have to change the look and feel of the application.
18
4) Less code than Servlet
In JSP, we can use a lot of tags such as action tags, jstl, custom tags etc. that reduces the code.
Moreover, we can use EL, implicit objects etc.
Fundamentally, JDBC is a specification that provides a complete set of interfaces that allows for
portable access to an underlying database. Java can be used to write different types of
executables, such as −
Java Applications
Java Applets
Java Servlets
19
All of these different executables are able to use a JDBC driver to access a database, and
take advantage of the stored data
20
Xampp
XAMPP is a free and open source cross-platform web server solution stack package developed
by Apache Friends, consisting mainly of the Apache HTTP Server, MariaDB database,
and interpreters for scripts written in the PHP and Perl programming languages. XAMPP stands
for Cross-Platform (X), Apache (A), MariaDB (M), PHP (P) and Perl (P). It is a simple,
lightweight Apache distribution that makes it extremely easy for developers to create a local web
server for testing and deployment purposes. Everything needed to set up a web server – server
application (Apache), database (MariaDB), and scripting language (PHP) – is included in an
extractable file. XAMPP is also cross-platform, which means it works equally well on Linux,
Mac and Windows. Since most actual web server deployments use the same components as
XAMPP, it makes transitioning from a local test server to a live server extremely easy as well.
21
Chapter 4
System Design
22
23
24
25
26
Entity Relationship
Diagram
(ERD)
27
Class Diagram
28
State-chart Diagram
29
Package Diagram
30
Chapter 4
List of Tables:
1.Product Table
2.category table
3.Subcategory table
31
4.User table
5.adminstrators table
6 product-company table
7 expenses table
8 images table
32
9
sales
10 user-details
11 orders
33
Chapter 7
Coding
34
35
36
Web.xml file
Web.xml
<servlet>
<servlet‐name>addAnAdministrator</servlet‐name>
<servlet‐class>admin.addAnAdministrator</servlet‐class>
37
</servlet>
<servlet>
<servlet‐name>administrator</servlet‐name>
<servlet‐class>admin.administrator</servlet‐class>
</servlet>
<servlet>
<servlet‐name>registerServlet</servlet‐name>
<servlet‐class>admin.registerServlet</servlet‐class>
</servlet>
<servlet>
<servlet‐name>_logoutServlet</servlet‐name>
<servlet‐class>loginRegister._logoutServlet</servlet‐class>
</servlet>
<servlet>
<servlet‐name>admin_login</servlet‐name>
<servlet‐class>loginRegister.admin_login</servlet‐class>
</servlet>
<servlet>
<servlet‐name>changeMyPass</servlet‐name>
<servlet‐class>loginRegister.changeMyPass</servlet‐class>
</servlet>
<servlet>
<servlet‐name>changeMyPassword</servlet‐name>
<servlet‐class>loginRegister.changeMyPassword</servlet‐class>
</servlet>
<servlet>
38
<servlet‐name>loginServlet</servlet‐name>
<servlet‐class>loginRegister.loginServlet</servlet‐class>
</servlet>
<servlet>
<servlet‐name>registerServlett</servlet‐name>
<servlet‐class>loginRegister.registerServlett</servlet‐class>
</servlet>
<servlet>
<servlet‐name>changeProductStatus</servlet‐name>
<servlet‐class>orders.changeProductStatus</servlet‐class>
</servlet>
<servlet>
<servlet‐name>addCategory</servlet‐name>
<servlet‐class>product.addCategory</servlet‐class>
</servlet>
<servlet>
<servlet‐name>addCompany</servlet‐name>
<servlet‐class>product.addCompany</servlet‐class>
</servlet>
<servlet>
<servlet‐name>addProduct</servlet‐name>
<servlet‐class>product.addProduct</servlet‐class>
</servlet>
<servlet>
<servlet‐name>addSubCategory</servlet‐name>
<servlet‐class>product.addSubCategory</servlet‐class>
39
</servlet>
<servlet>
<servlet‐name>buyItems</servlet‐name>
<servlet‐class>product.buyItems</servlet‐class>
</servlet>
<servlet>
<servlet‐name>getProductSubCategory</servlet‐name>
<servlet‐class>product.getProductSubCategory</servlet‐class>
</servlet>
<servlet>
<servlet‐name>removeCartProduct</servlet‐name>
<servlet‐class>product.removeCartProduct</servlet‐class>
</servlet>
<servlet>
<servlet‐name>removeCategory</servlet‐name>
<servlet‐class>product.removeCategory</servlet‐class>
</servlet>
<servlet>
<servlet‐name>removeCompany</servlet‐name>
<servlet‐class>product.removeCompany</servlet‐class>
</servlet>
<servlet>
<servlet‐name>removeSubCategory</servlet‐name>
<servlet‐class>product.removeSubCategory</servlet‐class>
</servlet>
<servlet>
40
<servlet‐name>getCompanyNames</servlet‐name>
<servlet‐class>product.addProductPack.getCompanyNames</servlet‐class>
</servlet>
<servlet>
<servlet‐name>addUserDetalsServlet</servlet‐name>
<servlet‐class>user.addUserDetalsServlet</servlet‐class>
</servlet>
<servlet‐mapping>
<servlet‐name>addAnAdministrator</servlet‐name>
<url‐pattern>/addAnAdministrator</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>administrator</servlet‐name>
<url‐pattern>/administrator</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>registerServlet</servlet‐name>
<url‐pattern>/registerServlet</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>_logoutServlet</servlet‐name>
<url‐pattern>/_logoutServlet</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>admin_login</servlet‐name>
<url‐pattern>/admin_login</url‐pattern>
41
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>changeMyPass</servlet‐name>
<url‐pattern>/changeMyPass</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>changeMyPassword</servlet‐name>
<url‐pattern>/changeMyPassword</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>loginServlet</servlet‐name>
<url‐pattern>/loginServlet</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>registerServlett</servlet‐name>
<url‐pattern>/registerServlett</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>changeProductStatus</servlet‐name>
<url‐pattern>/changeProductStatus</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>addCategory</servlet‐name>
<url‐pattern>/addCategory</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
42
<servlet‐name>addCompany</servlet‐name>
<url‐pattern>/addCompany</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>addProduct</servlet‐name>
<url‐pattern>/addProduct</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>addSubCategory</servlet‐name>
<url‐pattern>/addSubCategory</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>buyItems</servlet‐name>
<url‐pattern>/buyItems</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>getProductSubCategory</servlet‐name>
<url‐pattern>/getProductSubCategory</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>removeCartProduct</servlet‐name>
<url‐pattern>/removeCartProduct</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>removeCategory</servlet‐name>
<url‐pattern>/removeCategory</url‐pattern>
43
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>removeCompany</servlet‐name>
<url‐pattern>/removeCompany</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>removeSubCategory</servlet‐name>
<url‐pattern>/removeSubCategory</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>getCompanyNames</servlet‐name>
<url‐pattern>/getCompanyNames</url‐pattern>
</servlet‐mapping>
<servlet‐mapping>
<servlet‐name>addUserDetalsServlet</servlet‐name>
<url‐pattern>/addUserDetalsServlet</url‐pattern>
</servlet‐mapping>
<session‐config>
<session‐timeout>
30
</session‐timeout>
</session‐config>
</web‐app>
JSP files
Index.jsp
44
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="database.DB_Conn"%>
<!DOCTYPE HTML>
<html>
<head>
<title>Alpha BookStores</title>
$(document).ready(function() {
$('#slider').s3Slider({
timeOut: 7000
45
});
});
</script>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
46
<div id = "banner">
<div class="container_16">
<ul id="sliderContent">
<strong>Fountain Pens...</strong>
<br>From the International and Indian markets, we have the variety of the High Class fountain
</span>
</li>
47
<span class="top" style="display: none; ">
<strong>Books, Diaries...</strong>
<br>Text Books, Single Lines, Double Lines, Red 'n Blue Lines, Fullscape Books
Drawing Books, and all the paper you want to write all throughout to learn
</span>
</li>
<strong>Kids Colors...</strong>
48
<br>Collection of Non‐Toxic childrens colors available
</span>
</li>
<strong>Graphic Novels...</strong>
<br>The most amazing titles that you always wanted to get your hands onn..
Now you have the opportunity to have them all in your personal library.
</span>
49
</li>
<strong>Color World...</strong>
</span>
</li>
</ul>
</div>
</div>
</div>
50
<div class="container_16">
<div id = "contents">
<%
Statement st = c.createStatement();
ResultSet rs = st.executeQuery(getCategory);
%>
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Categories</strong></a></li>
<%
while (rs.next()){
%>
<%
51
}
%>
</ul>
</div>
<div class="adv">
</div>
</div>
</div>
<div id="middle"class="grid_13">
<jsp:include page="includesPage/mainHeaders/topMostViewedProducts_4.jsp"></jsp:include>
</div>
</div>
<jsp:include page="includesPage/_footer.jsp"></jsp:include>
</body>
</html>
addProductfilters.jsp
<%
if (request.getParameter("cat") != null ){
52
// set the session
session.setAttribute("cat", category);
if (request.getParameter("scat") != null ){
session.setAttribute("scat", subcategory);
response.sendRedirect("viewProducts_.jsp");
%>
removeProductfilters.jsp
<%
if (request.getParameter("cat") != null ){
session.removeAttribute("cat");
if (request.getParameter("scat") != null ){
session.removeAttribute("scat");
response.sendRedirect("viewProducts_.jsp");
%>
53
addToCart.jsp
<%@page import="java.util.ArrayList"%>
<%@page import="user.user"%>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
54
#loginBtn {
margin:15px auto;
padding:5px;
color:#000;
border‐radius:5px;
text‐align:center;
#loginBtn:hover {
color:#000;
border‐radius:7px;
text‐align:center;
cursor:pointer;
</style>
</head>
55
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<% } else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<% }
%>
<div class="container_16">
<%
session.getAttribute("user");
//out.println(session.getAttribute("user"));
56
User = (user) session.getAttribute("user");
if (session.getAttribute("user") == null) {
%>
<% } else {
%>
<%
int id;
if (request.getParameter("id") == null) {
response.sendRedirect("viewProduct_.jsp");
} else {
id = Integer.parseInt(sid);
boolean b = cart.addProduct(id);
if (b == true) {
} else {
57
out.println("Not added !!");
productNames = cart.getProductNames();
productPrices = cart.getPrices();
Qty = cart.getQty();
ids = cart.getId();
%>
<div class="grid_5">
<h2>Name Of Product</h2>
</div>
<div class="grid_2">
<h2>Price</h2>
</div>
<div class="grid_2">
<h2>Quantity</h2>
</div>
58
<%
%>
<div class="grid_5">
<%=productNames.get(i)%>
</div>
<div class="grid_2">
Rs. <%=productPrices.get(i)%>
</div>
<div class="grid_1">
x<%=Qty.get(i)%>
</div>
<div class="grid_2">
</div>
<%
productNames.clear();
productPrices.clear();
%>
<br/>
59
<div class="grid_5">
</div>
</div>
<div class="clear"></div>
<br/>
<br/>
<a href="buyItems.jsp">
</div>
</a>
<a href="viewProducts_.jsp">
Continue Shopping
</div>
</a>
</div>
<br/>
<br/>
60
<br/>
<%
%>
</div>
</div>
</div>
</body>
</html>
addToCart_View.jsp
<%@page import="java.util.ArrayList"%>
<%@page import="user.user"%>
<!DOCTYPE html>
<html>
<head>
61
<link rel="stylesheet" type="text/css" href="css/reset.css"/>
<style type="text/css">
#loginBtn {
margin:15px auto;
padding:5px;
color:#000;
border‐radius:5px;
text‐align:center;
62
#loginBtn:hover {
color:#000;
border‐radius:7px;
text‐align:center;
cursor:pointer;
</style>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<% } else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<% }
%>
63
<%@include file="includesPage/_facebookJoin.jsp" %>
<div class="container_16">
<%
session.getAttribute("user");
//out.println(session.getAttribute("user"));
if (session.getAttribute("user") == null) {
%>
<% } else {
%>
<%
64
out.println("<br/>Total value price of the cart " + cart.getTotalPriceOfCart());
productNames = cart.getProductNames();
productPrices = cart.getPrices();
Qty = cart.getQty();
ids = cart.getId();
%>
<div class="grid_5">
<h2>Name Of Product</h2>
</div>
<div class="grid_2">
<h2>Price</h2>
</div>
<div class="grid_2">
<h2>Quantity</h2>
</div>
<%
65
for (int i = 0; i < productNames.size(); i++) {
%>
<div class="grid_5">
<%=productNames.get(i)%>
</div>
<div class="grid_2">
Rs. <%=productPrices.get(i)%>
</div>
<div class="grid_1">
x<%=Qty.get(i)%>
</div>
<div class="grid_2">
</div>
<%
productNames.clear();
productPrices.clear();
%>
<br/>
<div class="grid_5">
66
</div>
</div>
<div class="clear"></div>
<br/>
<br/>
<a href="buyItems.jsp">
</div>
</a>
<a href="viewProducts_.jsp">
Continue Shopping
</div>
</a>
</div>
<br/>
<br/>
<br/>
67
<%
%>
</div>
</div>
</div>
</body>
</html>
buyItems.jsp
<%@page import="user.user"%>
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
68
<link rel="stylesheet" type="text/css" href="css/960_16.css"/>
<script src="js/jquery‐1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.shippingAddress {
background: #EEE;
padding: 10px;
cursor: pointer;
</style>
</head>
<body>
<%
%>
69
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<%
user User;
String email=null;
if ((session.getAttribute("user")==null)){
//response.sendRedirect("index.jsp");
}else {
User = (user)session.getAttribute("user");
email = User.getUserEmail();
%>
<div class="container_16">
<div class="grid_8">
70
<div class="grid_2">
Name
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_2">
Mobile No
</div>
<div class="grid_5">
</div>
<div class="grid_2">
Address
</div>
<div class="grid_5">
</div>
<div class="grid_2">
City
</div>
<div class="grid_5">
<input type="text" value="Delhi" disabled/> We Do not accept any orders outside Delhi.
</div>
<div class="clear"></div><br/>
71
<div class="grid_5" >
</div>
</form>
</div>
<%
%>
<div class="grid_1">
Name
</div>
<div class="grid_5">
</div>
<div class="clear"></div>
<div class="grid_1">
Mobile
</div>
<div class="grid_5">
</div>
<div class="grid_1">
Address
72
</div>
<div class="grid_5">
</div>
<div class="clear"></div>
</div>
<script type="text/javascript">
$(document).ready(function (){
$('#useInfo').click(function (){
$('.name').attr('value', userName);
$('.address').attr('value', address);
$('.mobile').attr('value', mobile);
});
});
</script>
<%
}else {
%>
<a href="userinfo.jsp">
73
<h1> <strong></strong>Add your Details for quick Checkout</h1>
</div>
</a>
<%
%>
</div>
</div>
</body>
</html>
Message.jsp
<!DOCTYPE HTML>
<html>
<head>
<title>Alpha BookStores</title>
74
<link rel="stylesheet" type="text/css" href="css/lightbox.css" />
<script src="js/jquery‐1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
75
<%
//response.sendRedirect("/saikiranBookstoreApp/index.jsp");
%>
<div class="container_16">
<h1>
<% out.print(request.getAttribute("message"));%></h1>
<%
out.print(request.getAttribute("messageDetail"));
%>
</h5>
</div>
76
</div>
</div>
</body>
</html>
findProductLoad.jsp
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="database.DB_Conn"%>
<%
if (request.getParameter("searchbar") != null){
77
String searches [] = searchText.split(" ");
/*
SELECT *
FROM `products`
WHERE
* WANT THIS
USING ( `product‐name` )
WHERE
GROUP BY `product‐name`
78
*/
//out.println (""+sqlSearch);
if (i != searches.length‐1){
%>
<div class="container_16">
79
<div class="grid_15 push_1">
<%
Connection c = con.getConnection();
Statement st = c.createStatement();
ResultSet rs = st.executeQuery(sqlSearch.toString());
while (rs.next()) {
/*
80
String category_name = rs.getString("category‐name");
/*
out.println("<br/>"+product_id+
"<br/>"+product_name+
"<br/>"+sub_category_name+
"<br/>"+category_name+
"<br/>"+company_name+
"<br/>"+price+
"<br/>"+summary+
"<br/>"+image_name);
*/
%>
<div class="clear"></div>
<div class="grid_2">
</div>
<div class="grid_14">
<div class="grid_10">
81
<p id="info"><a href="product.jsp?id=<%=product_id%>"><h3><span class="blue"> <
%=product_name %></span></h3></a>By <%= company_name+" "+ category_name
%><br/><span class="red">Rs. <%= price %></span></p>
</div>
<div class="grid_3">
</div>
</div>
<div class="clear"></div>
<%
rs.close();
st.close();
c.close();
%>
<div class="clear"></div>
</div></div>
</div>
<%
%><%
82
}
%>
viewProduct.jsp
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
83
<script src="js/jquery‐1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<div id = "contents">
<%
84
/*
* 1) Retrieve Category
* if Category set
* Show
* SubCategory
* Company
* Pricing
if SubCategory is set
* Shw
* Company
* Pricing
* else Show
* SubCategory
* Company
* Pricing
* else
* Show
* Category
* Pricing
85
*/
%>
<%
category = "";
subcategory = "";
if(session.getAttribute("cat") != null ){
%>
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Sub‐Categories</strong></a></li>
<%
%>
86
<%
} subCat.clear(); %>
</ul>
</div>
<%
if (session.getAttribute("scat") != null){
} else {
//Show Category
%>
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Categories</strong></a></li>
<%
%>
<%
} Cat.clear();
%>
</ul>
</div>
87
<%
%>
<!‐‐
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Categories</strong></a></li>
<li><a href="#">Books</a></li>
<li><a href="#">Calculators</a></li>
<li><a href="#">Games</a></li>
<li><a href="#">Movies</a></li>
</ul>
</div>
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Sub‐Categories</strong></a></li>
<li><a href="#">Books</a></li>
<li><a href="#">Calculators</a></li>
<li><a href="#">Games</a></li>
88
<li><a href="#">Movies</a></li>
</ul>
</div>
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Pricing</strong></a></li>
</ul>
</div>
‐‐>
<div class="adv">
</div>
</div>
</div>
<div id="middle"class="grid_13">
<div class="ProductHeading">
<div class="grid_12">
89
<%= category %>
</h2>
</div>
</div>
<div class="clear"></div>
<%
if (session.getAttribute("cat") != null){
category = (String)session.getAttribute("cat");
/*
GROUP BY `product‐name` */
%>
</div>
<%
%>
90
<%
if (session.getAttribute("scat") != null){
subcategory = (String)session.getAttribute("scat");
%>
</div>
<%
%>
<%
%>
<%
// + "USING ( `product‐name` )
// +`product_qty` > 0
Connection c = con.getConnection();
91
Statement st = c.createStatement();
ResultSet rs ;
)){
rs= st.executeQuery(newSQL);
}else {
rs= st.executeQuery(sql.toString());
while (rs.next()) {
92
/*
/*
out.println("<br/>"+product_id+
"<br/>"+product_name+
"<br/>"+sub_category_name+
"<br/>"+category_name+
"<br/>"+company_name+
"<br/>"+price+
"<br/>"+summary+
93
"<br/>"+image_name);
*/
%>
<div class="clear"></div>
<div class="grid_2">
</div>
<div class="grid_9">
<div class="grid_5">
</div>
</div>
</div>
<div class="clear"></div>
<%
rs.close();
st.close();
c.close();
%>
</div>
94
</div>
<jsp:include page="includesPage/mainHeaders/topMostViewedProducts_4.jsp"></jsp:include>
</div>
</div>
<jsp:include page="includesPage/_footer.jsp"></jsp:include>
</body>
</html>
Userinfo.jsp
<%@page import="cart.cart"%>
<%@page import="user.user"%>
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
95
<%@page import="java.sql.*, database.*" %>
<script src="js/jquery‐1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
#leftside {
cursor: pointer;
position: fixed;
</style>
<script type="text/javascript">
$(document).ready(function (){
96
var MyAccount = $('#Account');
MyOrders.click(function (){
Orders.slideDown(700);
Account.slideUp(700);
Settings.slideUp(700);
});
MyAccount.click(function (){
Orders.slideUp(700);
Account.slideDown(700);
Settings.slideUp(700);
});
MySettings.click(function (){
Orders.slideUp(700);
Account.slideUp(700);
Settings.slideDown(700);
});
MyUserInfo.click(function (){
Orders.slideDown(700);
Account.slideDown(700);
97
Settings.slideDown(700);
});
});
</script>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
user User;
if ((session.getAttribute("user") == null)) {
response.sendRedirect("index.jsp");
} else {
98
String email = User.getUserEmail();
if (userName == null){
printName = email;
else {
printName = userName;
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<ul id="leftsideNav">
<li><a id="Account">Account</a></li>
<li><a id="Settings">Settings</a></li>
</ul>
</div>
99
<div class="grid_13 push_3" id="whiteBox">
<div class="grid_13">
<h1 style ="text‐align: center; padding: 10px 0px 0px 0px;">Hello <%= printName %></h1>
Enter in the personal information for your Account to have quick checkouts during any
transaction
</p>
</div>
</div>
<div style ="text‐align: center; border‐top: 20px #444 solid; padding: 10px 0px 10px 0px;"
class="grid_12 MyOrders">
<div class="grid_1">
<h3>Order No</h3>
</div>
<div class="grid_7">
<div class="clear"></div>
<div class="grid_4">
Item
100
</div>
<div class="grid_2">
Price x Quantity
</div>
</div>
<h3>Date</h3>
</div>
<div class="clear"></div>
<%
/*
FROM `order` o
USING ( `order_id` )
WHERE o.`user_id` =4
*/
PreparedStatement psmt =
c.prepareStatement(sql);
ResultSet rs = psmt.executeQuery();
int oldOrder = 0;
int newOrder;
String product_name;
double product_price;
int product_quantity;
Date sold_on_date;
Time sold_on_time;
while (rs.next()){
newOrder = rs.getInt("order_id");
product_name = rs.getString("product_name");
product_price = rs.getDouble("product_price");
product_quantity = rs.getInt("product_quantity");
sold_on_time = rs.getTime("sold_on");
sold_on_date = rs.getDate("sold_on");
102
String billNo = "";
billNo += orderDateArr[i];
billNo+= newOrder;
if (oldOrder == newOrder){
%>
<div class="grid_12">
<div class="push_1">
<div class="grid_7">
<a href="product.jsp?id="></a>
</div>
<div class="grid_2">
</div>
</div>
<div class="grid_3">
</div>
</div>
</div>
103
<%
}else {
%>
<div class="grid_1">
</div>
<div class="grid_7">
</div>
<div class="grid_2">
</div>
</div>
<div class="grid_3">
</div>
</div>
<div class="clear"></div>
<%
104
}
oldOrder = newOrder;
%>
<div class="grid_1">
124
</div>
<div class="grid_7">
Assassins Creed II
</div>
<div class="grid_2">
Rs. 98205689 x5
</div>
</div>
<div class="grid_3">
12‐15‐2003 : 15:06
</div>
</div>
<div class="clear"></div>
‐‐>
105
<!‐‐ Type II Order ‐‐>
<div class="push_1">
<div class="grid_7">
Assassins Creed II
</div>
<div class="grid_2">
Rs. 999 x1
</div>
</div>
<div class="grid_3">
12‐15‐2003 : 15:06
</div>
</div>
</div>
‐‐>
</div>
</div>
<div class="clear"></div>
<div style ="text‐align: center; border‐top: 20px #444 solid; padding: 10px 0px 10px 0px;"
class="grid_9 push_1 Account">
106
<%
if (User.getUsername() == null) {
%>
<div class="grid_3">
Name
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_3">
Gender
</div>
<div class="grid_5">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</div>
<div class="clear"></div><br/>
<div class="grid_3">
Mobile No
</div>
<div class="grid_5">
107
<input type="text" name="mobileNum" maxlength="10" required/>
</div>
<div class="clear"></div><br/>
<div class="grid_3">
Address
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_3">
City
</div>
<div class="grid_5">
<input type="text" value="Delhi" disabled/><br/> We Do not accept any orders outside Delhi.
<br/><br/>
</div>
<div class="clear"></div><br/>
</form>
<%
}else {
%>
<div class="grid_3">
Name
108
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_3">
Gender
</div>
<div class="grid_5">
<%
if (User.getGender().equals("male")) {
%>
<option value="female">Female</option>
<% } else {
%>
<option value="male">Male</option>
<% }
%>
</select>
</div>
<div class="clear"></div><br/>
109
<div class="grid_3">
Mobile No
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_3">
Address
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_3">
City
</div>
<div class="grid_5">
<input type="text" value="Delhi" disabled/><br/> We Do not accept any orders outside Delhi.
<br/><br/>
</div>
<div class="clear"></div><br/>
</form>
<%
110
%>
</div>
<div class="clear"></div>
<div style ="text‐align: center; border‐top: 20px #444 solid; padding: 10px 0px 10px 0px;"
class="grid_9 push_1 Settings">
<div class="grid_3">
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_3">
Password
</div>
<div class="grid_5">
111
<input type="password" name="pass" /><br/><br/>
</div>
<div class="clear"></div><br/>
</form>
</div>
<div class="clear"></div>
</div>
</div>
<%
%>
<jsp:include page="includesPage/_footer.jsp"></jsp:include>
</body>
</html>
showMyBill.jsp
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
112
<jsp:useBean class="product.product" id="product" scope="session"></jsp:useBean>
<script src="js/jquery‐1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
width:90px;
position: relative;
color:#000;
border‐color:#696969;
outline: none;
padding:5px;
113
background: ‐webkit‐linear‐gradient(top, #EEE,#FFF);
color:#000;
border‐color:#696969;
outline: none;
font‐family:'Droid';
#whiteBox textarea:focus{
color:#000;
border‐color:#696969;
outline: none;
font‐family:'Droid';
114
}
#whiteBox textarea{
font‐family:'Droid';
#whiteBox {
padding‐top: 10px;
padding‐bottom: 10px;
padding: 10px;
#status {
margin: 17px;
padding: 7px;
font‐size: 17px;
text‐align: center;
</style>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
115
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<!‐‐
<hr/><br/>
<form>
</form>
</div>‐‐>
<%
if (request.getParameter("oid") != null){
116
String OrderId = request.getParameter("oid");
Statement st = c.createStatement() ;
while (rs1.next()){
String name,
Date ordered_on_date;
Time ordered_on_time;
name = rs1.getString("shippers_name");
email = rs1.getString("shippers_email");
address = rs1.getString("address");
mobileNum = rs1.getString("mobile_number");
ordered_on_date = rs1.getDate("ordered_On");
ordered_on_time = rs1.getTime("ordered_On");
status = rs1.getString("status");
%>
<div class="grid_7">
<div class="grid_2">
Name :
</div>
<div class="grid_3">
117
</div>
<div class="grid_2">
Email:
</div>
<div class="grid_3">
</div>
<div class="grid_2">
Address:
</div>
<div class="grid_3">
</div>
<div class="grid_2">
Mobile:
</div>
<div class="grid_3">
</div>
<div class="grid_2">
Ordered On:
</div>
<div class="grid_3">
</div>
</div>
118
<div class="grid_4" >
</div>
<% if (status.equals("delivered"))
%>
<%
%>
<div class="clear">
</div><br/>
</div>
</div>
<%
%>
<div class="grid_1">
<h3>Order No</h3>
</div>
119
<div class="grid_7">
<div class="clear"></div>
<div class="grid_4">
Item
</div>
<div class="grid_2">
Price x Quantity
</div>
</div>
<h3>Total Value</h3>
</div>
<div class="clear"></div>
<%
/*
FROM `order` o
USING ( `order_id` )
WHERE o.`user_id` =4
*/
120
String sql = "SELECT `order_id` , `product_name` , `product_price` , `product_quantity` ,
`sold_on` "
PreparedStatement psmt =
c.prepareStatement(sql);
ResultSet rs = psmt.executeQuery();
int oldOrder = 0;
int newOrder;
String product_name;
double product_price;
int product_quantity;
Date sold_on_date;
Time sold_on_time;
double totalPrice = 0;
double totalValue = 0;
while (rs.next()){
121
newOrder = rs.getInt("order_id");
product_name = rs.getString("product_name");
product_price = rs.getDouble("product_price");
product_quantity = rs.getInt("product_quantity");
sold_on_time = rs.getTime("sold_on");
sold_on_date = rs.getDate("sold_on");
totalValue = product_quantity*product_price;
totalPrice += totalValue;
billNo += orderDateArr[i];
billNo+= newOrder;
if (oldOrder == newOrder){
%>
<div class="grid_12">
<div class="push_1">
<div class="grid_7">
<a href="product.jsp?id="></a>
</div>
122
<div class="grid_2">
</div>
</div>
<div class="grid_3">
</div>
</div>
</div>
<%
}else {
%>
<div class="grid_12">
<div class="grid_1">
</div>
<div class="grid_7">
</div>
<div class="grid_2">
123
</div>
</div>
<div class="grid_3">
</div>
</div>
<div class="clear"></div>
<%
oldOrder = newOrder;
totalPrice = Math.ceil(totalPrice);
%>
<div class="clear"></div><br/>
<div class="grid_12">
<hr class="grid_11"/>
<div class="grid_4">
</div>
</div>
124
</div>
<div class="clear"></div>
</div>
</div>
</div>
<%
} else {
%>
<div class="container_16">
</div>
</div>
<%
%>
</body>
</html>
showMyBillPrint.jsp
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html>
<html>
125
<head>
<title>Alpha BookStores</title>
<script src="js/jquery‐1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
width:90px;
position: relative;
color:#000;
border‐color:#696969;
126
outline: none;
padding:5px;
color:#000;
border‐color:#696969;
outline: none;
font‐family:'Droid';
#whiteBox textarea:focus{
color:#000;
border‐color:#696969;
outline: none;
127
font‐family:'Droid';
#whiteBox textarea{
font‐family:'Droid';
#whiteBox {
padding‐top: 10px;
padding‐bottom: 10px;
padding: 10px;
#status {
margin: 17px;
padding: 7px;
font‐size: 17px;
text‐align: center;
</style>
</head>
<body>
<%‐‐
<div id = "" style="background: #AAA; padding: 10px; box‐shadow: 0px 10px 10px #555;">
128
<div class="grid_16">
<a href="index.jsp">
SaiKiran BookStores
</a>
</div>
<div class="grid_8">
+91 9004300647</p>
Silver Park,
Mumbai</p>
</div>
</div>
</div>
</div>
‐‐%>
<div class="container_16">
<div class="grid_16">
129
<div id="logo" class="grid_6"> <a href="index.jsp"><img src="images/logo/icon.png" /></a>
</div>
</div>
</div>
</div>
<div class="container_16">
<!‐‐
<hr/><br/>
<form>
</form>
</div>‐‐>
<%
if (request.getParameter("oid") != null) {
String fetchInfoSQL = "SELECT * FROM `order` WHERE `order_id` = '" + OrderId + "' ; ";
Statement st = c.createStatement();
130
while (rs1.next()) {
String name,
Date ordered_on_date;
Time ordered_on_time;
name = rs1.getString("shippers_name");
email = rs1.getString("shippers_email");
address = rs1.getString("address");
mobileNum = rs1.getString("mobile_number");
ordered_on_date = rs1.getDate("ordered_On");
ordered_on_time = rs1.getTime("ordered_On");
status = rs1.getString("status");
%>
<div class="grid_6">
<div class="grid_2">
To ;
</div>
<div class="clear">
</div>
<div class="grid_2">
Name :
</div>
<div class="grid_3">
<%= name%>
131
</div>
<div class="grid_2">
Email:
</div>
<div class="grid_3">
<%= email%>
</div>
<div class="grid_2">
Address:
</div>
<div class="grid_3">
<%= address%>
</div>
<div class="grid_2">
Mobile:
</div>
<div class="grid_3">
<%= mobileNum%>
</div>
<div class="grid_2">
Ordered On:
</div>
<div class="grid_3">
</div>
</div>
132
<div class="grid_5" id="whiteBox" style="margin‐top: 30px;">
<div class="grid_5">
<div class="grid_1">
From;
</div>
<div class="grid_3">
Alpha BookStores
</div>
<div class="grid_1">
Email:
</div>
<div class="grid_3">
kuldeeptomar07@gmail.com
</div>
<div class="grid_1">
Address:
</div>
<div class="grid_3">
</div>
<div class="grid_1">
Mobile:
</div>
<div class="grid_3">
+91‐8467878250
</div>
133
</div>
</div>
</div>
<%
%>
<div class="grid_1">
<h3>Order No</h3>
</div>
<div class="grid_7">
<div class="clear"></div>
<div class="grid_4">
Item
</div>
<div class="grid_2">
Price x Quantity
</div>
</div>
<h3>Total Value</h3>
</div>
<div class="clear"></div>
134
<%
/*
FROM `order` o
USING ( `order_id` )
WHERE o.`user_id` =4
*/
PreparedStatement psmt =
c.prepareStatement(sql);
ResultSet rs = psmt.executeQuery();
int oldOrder = 0;
135
int newOrder;
String product_name;
double product_price;
int product_quantity;
Date sold_on_date;
Time sold_on_time;
double totalPrice = 0;
double totalValue = 0;
while (rs.next()) {
newOrder = rs.getInt("order_id");
product_name = rs.getString("product_name");
product_price = rs.getDouble("product_price");
product_quantity = rs.getInt("product_quantity");
sold_on_time = rs.getTime("sold_on");
sold_on_date = rs.getDate("sold_on");
totalPrice += totalValue;
billNo += orderDateArr[i];
billNo += newOrder;
if (oldOrder == newOrder) {
136
%>
<div class="grid_12">
<div class="push_1">
<div class="grid_7">
<a href="product.jsp?id="></a>
<%= product_name%>
</div>
<div class="grid_2">
</div>
</div>
<div class="grid_3">
<%= totalValue%>
</div>
</div>
</div>
<%
} else {
%>
137
<div class="grid_12">
<div class="grid_1">
</div>
<div class="grid_7">
<%= product_name%>
</div>
<div class="grid_2">
</div>
</div>
<div class="grid_3">
<%= totalValue%>
</div>
</div>
<div class="clear"></div>
<%
oldOrder = newOrder;
totalPrice = Math.ceil(totalPrice);
%>
138
<!‐‐ Type I Order ‐‐>
<div class="clear"></div><br/>
<div class="grid_12">
<hr class="grid_11"/>
<div class="grid_4">
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<%
} else {
%>
<div class="container_16">
</div>
</div>
<% }
%>
139
</body>
</html>
Administrator
Admin_.jsp
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
140
<link rel="stylesheet" type="text/css" href="css/lightbox.css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
141
<div class="grid_13 push_2" id="whiteBox" style="padding:10px 0px 10px 0px;">
<div class="grid_2">
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_2">
Password
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
</form>
</div>
</div>
</div>
</body>
</html>
142
admin_performance.jsp
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
143
<script src="js/myScript.js"></script>
<style type="text/css">
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
#leftside {
cursor: pointer;
</style>
</head>
<body>
<%
%>
144
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
if (session.getAttribute("admin")== null){
response.sendRedirect("admin_.jsp");
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<br/>
<%
Statement st = c.createStatement();
ResultSet rs = null;
pendingOrders= "0",
approvedOrders= "0";
rs = st.executeQuery(sqlQuantity);
while (rs.next()){
qty = rs.getString("qty");
if (qty.equals("0")){
qty = "No";
146
rs = st.executeQuery(sqlPending);
while (rs.next()){
pendingOrders = rs.getString("pending");
if (pendingOrders.equals("0")){
pendingOrders = "No";
rs = st.executeQuery(sqlApproved);
while (rs.next()){
approvedOrders = rs.getString("approved");
if (approvedOrders.equals("0")){
approvedOrders = "No";
%>
</div>
<div class="clear"></div>
147
<script type="text/javascript" src="js/gclibrary/core1.js"></script>
<jsp:include page="includesPage/gChartings/gChart_ComboLine.jsp"></jsp:include>
<jsp:include
page="includesPage/hesders_sidebars/admin_menuSideBar.jsp"></jsp:include>
<div class="grid_13">
<jsp:include
page="includesPage/gChartings/gCharts_pieChartItemsSoldByCategory.jsp"></jsp:inclu
de>
<jsp:include
page="includesPage/gChartings/gCharts_pieChartItemsViewedByCategory.jsp"></jsp:in
clude>
</div>
<jsp:include
page="includesPage/gChartings/gCharts_top10ProductsSold.jsp"></jsp:include>
<jsp:include
page="includesPage/gChartings/gCharts_top10Products_viewed.jsp"></jsp:include>
</div>
</body>
</html>
admin_addProduct.jsp
<!DOCTYPE html>
<html>
148
<head>
<title>Alpha BookStores</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.highlight {
background: #E0E0E0;
149
.blueButton {
#buy {
padding: 30px;
font-size: 17px;
#buy:hover {
padding: 30px;
font-size: 17px;
/*
#buy {
padding: 30px;
font-size: 17px;
#buy:active {
150
padding: 30px;
font-size: 17px;
#buy:hover {
padding: 30px;
font-size: 17px;
}*/
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
151
box-shadow: 0px -1px 10px #333;
#leftside {
cursor: pointer;
</style>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
if (session.getAttribute("admin")== null){
response.sendRedirect("admin_.jsp");
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
152
<div class="container_16">
<div class="grid_3">
<br/><h1>Add Product</h1>
</div>
<div>
<div class="grid_3">
</div>
<div class="grid_3">
</div>
<div class="grid_3">
</div>
<div class="grid_3">
</div>
</div>
</div>
<div class="clear"></div>
<jsp:include
page="includesPage/hesders_sidebars/admin_menuSideBar.jsp"></jsp:include>
153
<div class="grid_13" style="padding: 10px 0px;" id="whiteBox">
<div class="grid_13">
</div>
<div class="grid_7">
<a style="
</div>
</div>
</div>
</body>
</html>
addProduct_1.jsp
<!DOCTYPE html>
<html>
<head>
154
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Alpha BookStores</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.buy {
margin-top:7px;
margin-bottom:15px;
float:right;
155
padding:5px;
color:#000;
padding:10px;
border-radius:5px;
text-align:center;
.buy:hover {
float:right;
color:#000;
border-radius:7px;
text-align:center;
padding:10px;
.highlight {
156
box-shadow: inset -10px 0px 10px #666;
background: #E0E0E0;
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
#leftside {
cursor: pointer;
</style>
</head>
<body>
<%
%>
157
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<% } else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<% }
if (session.getAttribute("admin")== null){
response.sendRedirect("admin_.jsp");
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<div class="grid_3">
<br/><h1>Add Product</h1><hr/>
</div>
<div>
</div>
<div class="grid_3">
</div>
158
<div class="grid_3">
</div>
<div class="grid_3">
</div>
</div>
</div>
<div class="clear"></div>
<jsp:include page="includesPage/hesders_sidebars/admin_menuSideBar.jsp"></jsp:include>
<%
Statement st = con.createStatement();
%>
<div class="grid_13">
159
<br/><h1>Step 1. Start selecting Product Company Or, Enter a one...</h1><hr/>
</div>
<div class="clear"></div>
<div class="grid_2">
<h3>Select Company</h3>
</div>
<div class="grid_5">
<%
while (company.next()) {
%>
<%
%>
</select>
160
</div>
<div class="clear"></div><br/>
<div class="grid_2">
Or
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_2">
</div>
<div class="grid_5">
</div>
<div class="grid_2">
</div>
<div class="clear"></div><br/>
<div class="grid_7">
</div>
<div class="grid_5">
161
<input id="buy" type="submit" value="Next >"/>
</div>
</form>
</div>
</div>
</body>
</html>
admin_addProduct2.jsp
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.buy {
margin-top:7px;
margin-bottom:15px;
float:right;
padding:5px;
color:#000;
padding:10px;
border-radius:5px;
text-align:center;
.buy:hover {
float:right;
color:#000;
border-radius:7px;
text-align:center;
padding:10px;
.highlight {
background: #E0E0E0;
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
#leftside {
cursor: pointer;
</style>
<script type="text/javascript">
$('#selectMenuCategory').click(function (){
$.get('getProductSubCategory',
{ category: category},
function (data){
$('#selectMenuSubCategory').html(data);
});
});
});
</script>
</head>
<body>
165
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<% } else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<% }
if (session.getAttribute("admin")== null){
response.sendRedirect("admin_.jsp");
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<div class="grid_3">
<br/><h1>Add Product</h1><hr/>
</div>
<div>
<div class="grid_3">
</div>
166
<div class="grid_3 highlight">
</div>
<div class="grid_3">
</div>
<div class="grid_3">
</div>
</div>
</div>
<div class="clear"></div>
<jsp:include page="includesPage/hesders_sidebars/admin_menuSideBar.jsp"></jsp:include>
<%
167
DB_Conn conn = new DB_Conn();
Statement st = con.createStatement();
if (productBean.getCompany() == null ||
productBean.getCompany() == ""){
response.sendRedirect("admin_addProduct_1.jsp");
%>
<div class="grid_13">
</div>
<div class="clear"></div>
<div class="grid_2">
<h3>Select Category</h3>
</div>
<div class="grid_5">
<%
ResultSet rs = st.executeQuery(sql_getCategory);
while (rs.next()) {
%>
<%
%>
</select>
</div>
<div class="clear"></div><br/>
<div class="grid_2">
Or
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_2">
<h3>Add Sub-Category</h3>
</div>
<div class="grid_5">
<div class="grid_2">
</div>
<div class="clear"></div><br/>
<div class="grid_7">
</div>
<div class="clear"></div>
<div class="grid_2">
<h3>Select Category</h3>
</div>
<div class="grid_5">
<%
while (subCategory.next()) {
%>
<%
}
170
st.close();
%>
</select>
</div>
<div class="clear"></div><br/>
<div class="grid_2">
Or
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_2">
<h3>Add Sub-Category</h3>
</div>
<div class="grid_5">
<div class="grid_2">
</div>
<div class="clear"></div><br/>
<div class="grid_7">
</div>
<div class="grid_5">
</form>
</div>
</div>
</body>
</html>
admin_addProduct3.jsp
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.buy {
margin-top:7px;
margin-bottom:15px;
float:right;
padding:5px;
color:#000;
padding:10px;
border-radius:5px;
text-align:center;
.buy:hover {
float:right;
color:#000;
border-radius:7px;
text-align:center;
padding:10px;
.highlight {
background: #E0E0E0;
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
174
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
#leftside {
cursor: pointer;
</style>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<% } else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<% }
if (session.getAttribute("admin")== null){
response.sendRedirect("admin_.jsp");
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
175
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<div class="grid_3">
<br/><h1>Add Product</h1><hr/>
</div>
<div>
<div class="grid_3">
</div>
<div class="grid_3">
</div>
</div>
<div class="grid_3">
</div>
</div>
</div>
<div class="clear"></div>
<jsp:include page="includesPage/hesders_sidebars/admin_menuSideBar.jsp"></jsp:include>
176
<jsp:useBean class="product.productBean" scope="session" id="productBean"></jsp:useBean>
<%
if (productBean.getCompany() == null ||
productBean.getCompany() == ""){
response.sendRedirect("admin_addProduct_1.jsp");
productBean.getCategory() == "" ||
productBean.getSubcategory() == null ||
productBean.getSubcategory() == "" ){
response.sendRedirect("admin_addProduct_2.jsp");
%>
<style type="text/css">
.error {
</style>
<script type="text/javascript">
name.keyup(function (){
if ((name.attr('value').indexOf('\'') != -1)){
name.addClass('error');
} else {
name.removeClass('error');
tags.val(valueTag);
});
tags.keyup(function (){
if ((tags.attr('value').indexOf('\'') != -1)){
tags.addClass('error');
}else {
tags.removeClass('error');
});
});
</script>
<div class="grid_13">
178
<br/><h1>Step 3. Enter in Product Name, Tags</h1><hr/>
</div>
<div class="clear"></div>
<div class="grid_4">
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_4">
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
179
<div class="grid_7">
</div>
</form>
</div>
</div>
</body>
</html>
Admin_addProduct3_1.jsp
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.buy {
margin-top:7px;
margin-bottom:15px;
float:right;
padding:5px;
color:#000;
padding:10px;
border-radius:5px;
text-align:center;
181
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27);
.buy:hover {
float:right;
color:#000;
border-radius:7px;
text-align:center;
padding:10px;
.highlight {
background: #E0E0E0;
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
#leftside {
cursor: pointer;
</style>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<% } else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<% }
if (session.getAttribute("admin")== null){
response.sendRedirect("admin_.jsp");
%>
183
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<div class="grid_3">
<br/><h1>Add Product</h1><hr/>
</div>
<div>
<div class="grid_3">
</div>
<div class="grid_3">
</div>
</div>
<div class="grid_3">
</div>
</div>
</div>
<div class="clear"></div>
184
<jsp:include page="includesPage/hesders_sidebars/admin_menuSideBar.jsp"></jsp:include>
<%
if (productBean.getCompany() == null ||
productBean.getCompany() == ""){
response.sendRedirect("admin_addProduct_1.jsp");
productBean.getCategory() == "" ||
productBean.getSubcategory() == null ||
productBean.getSubcategory() == "" ){
response.sendRedirect("admin_addProduct_2.jsp");
%>
<style type="text/css">
.error {
</style>
<script type="text/javascript">
name.keyup(function (){
if ((name.attr('value').indexOf('\'') != -1)){
name.addClass('error');
} else {
name.removeClass('error');
tags.val(valueTag);
});
tags.keyup(function (){
if ((tags.attr('value').indexOf('\'') != -1)){
tags.addClass('error');
}else {
tags.removeClass('error');
});
});
</script>
</div>
<div class="clear"></div>
<div class="grid_4">
</div>
<div class="grid_5">
</div>
<div class="clear"></div><br/>
<div class="grid_4">
</div>
<div class="grid_5">
</div>
187
<div class="clear"></div><br/>
<div class="grid_7">
</div>
</form>
</div>
</div>
</body>
</html>
Admin_addProdutController.jsp
<!DOCTYPE html>
<html>
<head>
<title>Alpha BookStores</title>
188
<%@page import="java.sql.*, database.*" %>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/lightbox.js"></script>
<script src="js/myScript.js"></script>
<style type="text/css">
.highlight {
background: #E0E0E0;
.blueButton {
189
#buy {
padding: 30px;
font-size: 17px;
#buy:hover {
padding: 30px;
font-size: 17px;
/*
#buy {
padding: 30px;
font-size: 17px;
#buy:active {
padding: 30px;
font-size: 17px;
#buy:hover {
padding: 30px;
font-size: 17px;
}*/
.adminMenu {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 0px;
background: #FFF;
.adminMain {
margin-top: 10px;
margin-bottom: 10px;
background: #FFF;
#leftside {
cursor: pointer;
}
191
</style>
</head>
<body>
<%
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
%>
<jsp:include page="includesPage/_search_navigationbar.jsp"></jsp:include>
<jsp:include page="includesPage/_facebookJoin.jsp"></jsp:include>
<div class="container_16">
<div class="grid_15">
</div>
</div>
<div class="clear"></div>
192
<div id="leftside" class="grid_3">
<ul id="leftsideNav">
<li><a><strong>Dash Home</strong></a></li>
<li><a>Stock</a></li>
<li><a>Performance</a></li>
<li><a>Orders</a></li>
<li><a>Settings</a></li>
</ul>
</div>
193
<div class="grid_13" style="padding: 10px 0px;" id="whiteBox">
<div class="grid_13">
<%
if (request.getParameter("page") != null){
response.sendRedirect(request.getParameter("page"));
}else {
response.sendRedirect("index.jsp");
%>
</div>
</div>
</div>
</body>
</html>
Java Classes
DB_Conn.java
194
/*
*/
package cart;
import java.sql.*;
/*
* @author Kuldeep
*/
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/"+database+"",""+username+"
",""+password+"");
// stm=con.createStatement();
return con;
return database;
195
public void setDatabase(String database) {
this.database = database;
return username;
this.username = username;
return password;
this.password = password;
Cart.java
/*
*/
196
package cart;
import java.sql.*;
import java.util.*;
Connection c;
return res;
197
}
//this method will genarate the prices of produt names which have an id
c = new DB_Conn().getConnection();
Statement st = c.createStatement();
/*
FROM `products`
WHERE `product_id` =1
*/
ResultSet rs = st.executeQuery(getItemName);
rs.next();
productName.add(p_name);
productCategory.add(p_Category);
prices.add(p_price);
198
public ArrayList<String> getProductCategorys() {
return productCategory;
System.out.println(""+productName.get(i));
}*/
return productName;
System.out.println(""+prices.get(i));
}*/
listItemsOfCart();
return prices;
//return p_name;
c = new DB_Conn().getConnection();
199
String getProductName = "SELECT `product-name` FROM `products` WHERE `product_id`
=" + id + "";
Statement st = c.createStatement();
ResultSet rs = st.executeQuery(getProductName);
rs.next();
return name;
//return p_name;
c = new DB_Conn().getConnection();
Statement st = c.createStatement();
/*SELECT `category-name`
FROM `products`
ResultSet rs = st.executeQuery(getCategoryName);
rs.next();
return name;
c = new DB_Conn().getConnection();
200
String getProductName = "SELECT `price` FROM `products` WHERE `product_id` =" + id +
"";
Statement st = c.createStatement();
ResultSet rs = st.executeQuery(getProductName);
rs.next();
return price;
// ids (Product name) => retrieve price (Store it) => Multiply by *qty
c = new DB_Conn().getConnection();
Statement st = c.createStatement();
ResultSet rs = st.executeQuery(sqlGetPrice);
rs.next();
//theres only one value in resultset so go one step further and get the value
double f = rs.getFloat("price");
t_prices.add(f);
double sum = 0;
double p = t_prices.get(i);
sum += p;
return sum;
return qty;
return id;
Statement st = c.createStatement();
ResultSet rs = st.executeQuery(sqlGetValidIds);
while (rs.next()) {
if (id_db == id) {
matches = true;
break;
if (matches = true) {
if (this.id.contains(id)) {
} else {
203
//Add one qty
this.qty.add(1);
//Add productID
this.id.add(id);
added = true;
} else {
added = false;
return added;
boolean removed;
if (this.id.contains(productId)) {
//this.id.indexOf(productId);
this.productCategory.remove(index);
this.productName.remove(index);
this.prices.remove(index);
204
this.qty.remove(index);
this.id.remove(index);
removed = true;
}else {
removed = false;
/*
if (this.id.contains(productId)) {
//this.id.indexOf(productId);
if (quantity == 1) {
this.productCategory.remove(index);
this.productName.remove(index);
this.prices.remove(index);
this.qty.remove(index);
this.id.remove(index);
} else {
quantity -= 1;
205
this.qty.set(index, quantity);
removed = true;
} else {
removed = false;
}*/
return removed;
try {
/*
do {
}while (choice.equals("1"));*/
while (choice.equals("1")) {
int id = sc.nextInt();
c.addProduct(id); //Good
206
System.out.println("Do u wish to continue?");
choice = sc.next();
c.showProducts(); //Good
//c.listItemsOfCart();
choice = "1";
while ("1".equals(choice)) {
int id = sc.nextInt();
if (removeProduct){
207
System.out.println(p_Category.get(i) + " " + productNames.get(i) + " \t\t" +
prices1.get(i) + " \t\t" + qty1.get(i) + " \t\t" + prices1.get(i) * qty1.get(i));
else {
//c.getTotalPriceOfCart();
} catch (SQLException e) {
System.out.println("" + e);
} catch (ClassNotFoundException e) {
System.out.println("" + e);
Product.java
/*
208
* and open the template in the editor.
*/
package product;
import database.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Scanner;
int id;
executeQuery.next();
id = executeQuery.getInt("product_id");
return id;
con = c.getConnection();
while (executeQuery.next()){
this.category.add(category1);
return category;
con = c.getConnection();
"FROM `sub-category`;";
this.subcategory.add(subcategory1);
return subcategory;
con = c.getConnection();
psmt.setString(1, category);
while (executeQuery.next()){
this.subcategory.add(subcategory1);
return subcategory;
211
DB_Conn c = new DB_Conn();
con = c.getConnection();
psmt.setString(1, category);
while (executeQuery.next()){
this.company.add(company_name);
return company;
con = c.getConnection();
this.company.add(company_name);
return company;
public static void main (String args []) throws SQLException, ClassNotFoundException{
System.out.println(" "+company1.get(i));
System.out.println("");
System.out.println(" "+subcategory1.get(i));
p.getId(next);
213
System.out.println(" "+
p.getId(next));
loginServlet.java
package loginRegister;
/*
*/
import database.DB_Conn;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import helpers.*;
import java.sql.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpSession;
214
import user.user;
/**
* <code>GET</code> and
* <code>POST</code> methods.
*/
response.setContentType("text/html;charset=UTF-8");
try {
/* TODO output your page here. You may use following sample code. */
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet loginServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("</html>");
} finally {
out.close();
/**
* <code>GET</code> method.
*/
@Override
//processRequest(request, response);
doPost(request, response);
/**
216
* <code>POST</code> method.
*/
@Override
//processRequest(request, response);
email = request.getParameter("email");
pass = request.getParameter("pass");
message = "";
messageDetail = "";
RequestDispatcher dispatchMessage =
request.getServletContext().getRequestDispatcher(messageUrl);
217
try {
pass = SecureSHA1.getSHA1(pass);
Connection c = con.getConnection();
PreparedStatement st = c.prepareStatement(sqlGetUsers);
ResultSet rs = st.executeQuery();
while (rs.next()) {
db_email = rs.getString("email");
db_pass = rs.getString("pass");
System.out.print(db_email);
System.out.print(db_pass);
if (email.equals(db_email)) {
User.setUserEmail(email);
userSession.setAttribute("user", User);
response.sendRedirect(request.getContextPath()+"/index.jsp");
*/
isLoggedIn = true;
User.setUserEmail(email);
userSession.setAttribute("user", User);
response.sendRedirect(request.getContextPath()+"/index.jsp");
else {
isLoggedIn = false;
messageDetail = "Password does not match with the password during registeration... Please re-
login with correct password";
break;
else {
//or there no such email YOu do not exist with us Create an account now!!
messageDetail = "Please register with us right now to buy items on the go!";
isLoggedIn = false;
}
219
}
if (isLoggedIn == false){
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
} catch (SQLException e) {
//response.sendError(404);
messageDetail = "We are extremely sorry to have this but we had an error during your process of
login please do try after some time,";
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
} catch (Exception e) {
//response.sendError(404);
/**
220
* @return a String containing servlet description
*/
@Override
}// </editor-fold>
registerServeltt.java
/*
*/
package loginRegister;
import database.DB_Conn;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import helpers.*;
import java.sql.*;
import javax.servlet.RequestDispatcher;
221
import javax.servlet.http.HttpSession;
import user.user;
/**
* <code>GET</code> and
* <code>POST</code> methods.
*/
response.setContentType("text/html;charset=UTF-8");
try {
/*
* TODO output your page here. You may use following sample code.
*/
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet registerServlet</title>");
222
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
/**
* <code>GET</code> method.
*/
@Override
processRequest(request, response);
223
/**
* <code>POST</code> method.
*/
@Override
//processRequest(request, response);
message = null;
messageDetail = null;
RequestDispatcher dispatchMessage =
request.getServletContext().getRequestDispatcher(messageUrl);
email = request.getParameter("emailReg");
pass = request.getParameter("passReg");
passAgain = request.getParameter("passAgainReg");
224
EmailValidator validator = new EmailValidator();
try {
Connection c = con.getConnection();
if (isEmailValid) {
if (pass.length() > 7) {
if (pass.equals(passAgain)) {
psmt.setString(1, email);
psmt.setString(2, pass);
225
int i = psmt.executeUpdate();
if (i == 1) {
isRegistered = true;
User.setUserEmail(email);
userSession.setAttribute("user", User);
response.sendRedirect(request.getContextPath());
} else {
isRegistered = false;
else {
isRegistered = false;
else {
isRegistered = false;
else {
isRegistered = false;
else {
isRegistered = false;
messageDetail = "Please provide an email address. Your account currently is not registered";
if (isRegistered == false) {
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
227
messageDetail = ex.getMessage();
message = "You have been registered earlier please try your right password again, else change
your password...";
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
messageDetail = ex.getMessage();
message = "There was a problem in registering your account please do retry again later...";
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
response.sendError(404);
/**
*/
@Override
}// </editor-fold>
228
}
addCategory.java
/*
*/
package product;
import database.DB_Conn;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* <code>GET</code> and
* <code>POST</code> methods.
*
229
* @param request servlet request
*/
response.setContentType("text/html;charset=UTF-8");
try {
/*
* TODO output your page here. You may use following sample code.
*/
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet addCategory</title>");
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
230
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the
left to edit the code.">
/**
* <code>GET</code> method.
*/
@Override
processRequest(request, response);
/**
* <code>POST</code> method.
*/
@Override
231
protected void doPost(HttpServletRequest request, HttpServletResponse response)
//processRequest(request, response);
out.print(message);
String message;
if (categoryName.equals("")){
else {
try {
//out.println("Done!!");
Connection con;
con = conn.getConnection();
232
//String sqlInsertProduct = "INSERT INTO `alpha `.`category` (`category_id`
,`category_name`)VALUES (NULL , '"+companyName+"'); ";
Statement st = con.createStatement();
if (rows != 1){
}else {
st.close();
con.close();
//out.println("A comany name with the same name exists in your database... Try being
specific.");
message = "A category name with the same name exists in your database... Try being specific.";
message = "There was a problem in Connectiong DB <br/> Exception has occoured "+ex;
message = "Application Cannot find the Class <br/> Exception has occoured "+ex;
return message;
/**
*/
@Override
}// </editor-fold>
addProduct.java
/*
*/
package product;
import java.sql.*;
234
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import database.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpSession;
/**
* <code>GET</code> and
* <code>POST</code> methods.
*/
try {
/*
* TODO output your page here. You may use following sample code.
*/
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet addProduct</title>");
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
/**
* <code>GET</code> method.
236
* @throws ServletException if a servlet-specific error occurs
*/
@Override
//processRequest(request, response);
//response.setContentType("text/html;charset=UTF-8");
RequestDispatcher dispacher;
/*
dispacher =
getServletContext().getRequestDispatcher(url);
dispacher.forward(request, response);
*/
company = request.getParameter("company");
productQty = request.getParameter("productQty");
productName = request.getParameter("productName");
category = request.getParameter("category");
subCategory = request.getParameter("subCategory");
price = request.getParameter("price");
tags = request.getParameter("tags");
237
//discountedPrice = request.getParameter("discountedPrice");
summary = request.getParameter("summary");
if (!productName.equals("") || !price.equals("") ){
try {
+ "`alpha`.`products` "
+ "(`product_id` ,"
+ "`product-name` ,"
+ "`sub-category-name` ,"
+ "`category-name` ,"
+ "`company-name` ,"
+ "`price` ,"
+ "`summary`, "
+ "`tags`, "
+ "`product_qty` ) "
+ "VALUES "
+ ""
238
+ "(NULL , "
+ "'"+productName+"', "
+ "'"+subCategory+"', "
+ "'"+category+"', "
+ "'"+company+"', "
+ "'"+price+"', "
+ "'"+summary+"', "
+ "'"+tags+"', "
+ ""+productQty+");";
Statement st = con.createStatement();
if (rows == 1){
while (executeQuery.next()){
ProductId = executeQuery.getString("product_id");
239
}
session.setAttribute("productName", productName);
session.setAttribute("productId", ProductId);
out.print("Product inserted");
//"http://localhost/uploadProductFile/"
url ="/productInsertImages.jsp";
request.setAttribute("productName", productName);
request.setAttribute("message", message);
request.setAttribute("messageDetails", messageDetails);
dispacher =
getServletContext().getRequestDispatcher(url);
dispacher.forward(request, response);
st.close();
con.close();
url ="/productInsertImages.jsp";
240
request.setAttribute("message", message);
request.setAttribute("messageDetails", messageDetails);
dispacher =
getServletContext().getRequestDispatcher(url);
//dispacher.forward(request, response);
url ="/productInsertImages.jsp";
request.setAttribute("message", message);
request.setAttribute("messageDetails", messageDetails);
dispacher =
getServletContext().getRequestDispatcher(url);
//dispacher.forward(request, response);
else {
url ="/productInsertImages.jsp";
request.setAttribute("message", message);
request.setAttribute("messageDetails", messageDetails);
dispacher =
getServletContext().getRequestDispatcher(url);
dispacher.forward(request, response);
/**
* <code>POST</code> method.
*/
@Override
//processRequest(request, response);
doGet(request, response);
242
/**
*/
@Override
}// </editor-fold>
removeCategory.java
/*
*/
package product;
import database.DB_Conn;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.logging.Level;
243
import java.util.logging.Logger;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author chirag
*/
/**
* <code>GET</code> and
* <code>POST</code> methods.
*/
response.setContentType("text/html;charset=UTF-8");
/* TODO output your page here. You may use following sample code. */
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet removeCategory</title>");
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
/**
* <code>GET</code> method.
*/
@Override
245
protected void doGet(HttpServletRequest request, HttpServletResponse response)
doPost(request, response);
/**
* <code>POST</code> method.
*/
@Override
message = "";
messageDetail = "";
RequestDispatcher dispatchMessage =
request.getServletContext().getRequestDispatcher(messageUrl);
try {
//processRequest(request, response);
246
ArrayList<Integer> subcategory = new ArrayList<Integer>();
subcategory.clear();
Statement st = c.createStatement();
while (parameterNames.hasMoreElements()){
subcategory.add(Integer.parseInt(parameterValues[i]));
}else {
subcategory.add(Integer.parseInt(parameterValues[0]));
subcategory.get(i);
st.addBatch(sqlCategory);
247
}
st.executeBatch();
response.sendRedirect("/Alpha%20Bookstore/admin_settings.jsp");
messageDetail = "There was an error during the deletion of the process, Please try after some
time";
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
messageDetail = "There was an error during the deletion of the process, Please try after some
time";
request.setAttribute("message", message);
request.setAttribute("messageDetail", messageDetail);
dispatchMessage.forward(request, response);
/**
*/
@Override
}// </editor-fold>
249
250