Memory Based Oops
Memory Based Oops
Memory Based Oops
A Project report
submitted in partial fulfillment of the requirements
for the award of the degree
of
BACHELOR OF TECHNOLOGY (B. TECH)
in
COMPUTER SCIENCE AND ENGINEERING
By
KULDEEP TOMAR
14015001007
I declare that the work which is being presented in this project entitled “Alpha Book Store” 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
Roll No.14015001007
Department of Computer Science and Engineering
International Institute of Technology & Management
ii
Certificate
This is to certify that the work in this project entitled “Alpha Book Store” submitted by Mr.
KULDEEP TOMAR in partial fulfillment of the requirements for the award of degree of Bachelor
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.
iii
Acknowledgments
First of all, I am thankful to almighty GOD to help me out in every odd and buts. There are
numerous people without whom this project might never have been completed. Among those who
deserve credit and our heartfelt gratitude is the most important Mr. Ram Kumar, Assistant
Professor (CSE) for his valuable guidance and support. Without him this work would not have
been possible. I am also thankful to my cousin sister Ms. Shelja Malik for her 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 TOMAR
iv
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 including
books, electronics, gaming, entertainment, 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 being 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.
v
Table of Contents
Content Page
Candidate’s Declaration ii
Certificate iii
Acknowledgement iv
Abstract v
Table of Contents vi
List of Figures viii
List of Tables x
vi
Chapter 4 System Design 21-27
4.1 User Case Diagram 21
4.2 Package Diagram 24
4.3 List of Tables 25
Bibliography 46
Appendix 47-59
vii
List of Figures
Content Page
5.2 Alpha Book Store home page when login form extended 29
viii
5.10 User have filled their details here and ready to go 33
5.12 User has confirmed their order and its status is pending 34
5.14 User order has been delivered, now user can print their bill 35
5.19 The Alpha Book Store performance through Line graph and Pie Chart 38
5.20 Items viewed by Category through pie chart & product sold through line graph 38
5.24 Admin has added the Category and SubCategory name of the book 40
5.25 Admin has added the book name and its search tag 41
5.26 Admin has added the book price, quantity and a brief summary 41
5.28 List of products pending and need an approval from the admin 42
5.29 List of products pending and need an approval from the admin 43
5.30 Admin setting page, here admin can add a user to admin panel 43
5.31 Admin setting page, here admin can delete the selected category or subcategory 44
ix
List of Tables
Content Page
4.1 Product table structure 25
x
xi
Chapter 1
INTRODUCTION
1.1 E-commerce
E-commerce (electronic commerce or EC) is the buying and selling of goods and services, or the
transmitting of funds or data, over an electronic network, primarily the internet. These business
transactions occur either as business-to-business, business-to-consumer, consumer-to-consumer or
consumer-to-business. The terms e-commerce and e-business are often used interchangeably. The
term e-tail is also sometimes used in reference to transactional processes for online shopping.
The beginnings of e-commerce can be traced to the 1960s, when businesses started
using Electronic Data Interchange (EDI) to share business documents with other companies. In
1979, the American National Standards Institute developed ASC X12 as a universal standard for
businesses to share documents through electronic networks. After the number of individual users
sharing electronic documents with each other grew in the 1980s, in the 1990s the rise of eBay
and Amazon revolutionized the e-commerce industry. Consumers can now purchase endless
amounts of items online, both from typical brick and mortar stores with e-commerce capabilities
and one another.
E-commerce is conducted using a variety of applications, such as email, online catalogs and
shopping carts, EDI, File Transfer Protocol, and web services. This includes business-to-business
activities and outreach such as using email for unsolicited ads (usually viewed as spam) to
consumers and other business prospects, as well as to send out e-newsletters to subscribers. More
companies now try to entice consumers directly online, using tools such as digital coupons, social
media marketing and targeted advertisements.
The benefits of e-commerce include its around-the-clock availability, the speed of access, the wide
availability of goods and services for the consumer, easy accessibility, and international reach. Its
perceived downsides include sometimes-limited customer service, consumers not being able to see
or touch a product prior to purchase, and the necessitated wait time for product shipping.
The e-commerce market continues to grow: Online sales accounted for more than a third of total
U.S. retail sales growth in 2015, according to data from the U.S. Commerce Department. Web
sales totaled $341.7 billion in 2015, a 14.6% increase over 2014. E-commerce conducted using
mobile devices and social media is on the rise as well: Internet Retailer reported that mobile
accounted for 30% of all U.S. e-commerce activities in 2015. And according to Invesp, 5% of all
online spending was via social commerce in 2015, with Facebook, Pinterest and Twitter providing
the most referrals.
The rise of e-commerce forces IT personnel to move beyond infrastructure design and maintenance
and consider numerous customer-facing aspects such as consumer data privacy and security.
When developing IT systems and applications to accommodate e-commerce activities, data
governance related regulatory compliance mandates, personally identifiable information privacy
rules and information protection protocols must be considered.
In the United States, the Federal Trade Commission (FTC) and the Payment Card Industry (PCI)
Security Standards Council are among the primary agencies that regulate e-commerce activities.
The FTC monitors activities such as online advertising, content marketing and customer privacy,
while the PCI Council develops standards and rules including PCI-DSS compliance that outlines
procedures for proper handling and storage of consumers' financial data.
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.
2
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 being 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.
1. The system is manual thus it does not provide a graphical user interface.
2. Needs more space for maintenance, the current system is very time consuming.
3. It is very difficult to search the detail of a customer or the event detail for anyone unless he/she
5. It creates confusion and makes it difficult to find the details of the customer. Many a times the
6. This type of working system increases the workload of the person who is looking after these
diaries.
3
7. 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.
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.
4
1.5.1 Different types of feasibility study:
Technical feasibility
Operational feasibility
Economic feasibility
This is concerned with the specifying equipment and software that will successfully satisfy the
requirements. The proposed system is technically feasible as it can be developed easily with the
help of available technology. The proposed system requires Xampp which is used as backend and
JSP and Servlet as front end.
Economic analysis is the most frequently used technique for evaluating the effectiveness of the
proposed system. The producer is to determine the benefits and the saving that are expected from
a proposed system and compare them with the proposed system. The only tangible benefits
proposed that the manual work and burden is reduced maximum as possible, resulting the reduction
in manpower requirement and cost incurred on manpower as well. The system provides many
benefits that can’t be measured in terms of money for e.g. user friendliness, more efficient user
response, maintenance of database etc.
The proposed system is highly user friendly and it is much easily to interact with the user.
Therefore, the user will easily accept the system as data entry system and queries can be easily
solved.
5
1.6 Fact finding techniques
Few personal interview questions:
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 type of book from Medical, Management, Engineering and School.
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, Amazon, 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 Medical, Management, Engineering and School. Now these major categories are then
classified into minor sub‐categories, take the example of here an Engineering, An Engineering
branch may be Civil, Electrical, Electronics and Computer etc.
5) Will you deal with courier system if the system will be online?
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 Delhi because we
need not want counterfeit in credit cards as we even had not being using credit/debit cards for
online purchases
6
Chapter 2
ARCHITECTURE USED
RAM: 8GB
OS: Window 10
7
Chapter 3
TOOLS AND TECHNOLOGY USED
3.1 Introduction
In this project the tools and technology we have used are as follows:
Java
NetBeans IDE
Servlet
JSP
JDBC
Xampp
jQuery
According to Sun, 3 billion devices run java. There are many devices where Java is currently used.
Some of them are as follows:
4. Mobile
5. Embedded System
8
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.
4) JavaFx
It is used to develop rich internet applications. It uses light-weight user interface API.
9
3.2.4 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
9. Interpreted
10. High Performance
11. Multithreaded
12. Distributed
10
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
6. Encapsulation
11
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
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-
12
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 securities are provided by java language. Some security can also be provided by application
developer through SSL, JAAS, Cryptography etc.
Robust
Robust simply means strong. Java uses strong memory management. There is lack of
pointers that avoids security problem. There is automatic garbage collection in java.
13
There is exception handling and type checking mechanism in java. All these points
make java robust.
Architecture-neutral
There are no implementation dependent features e.g. size of primitive types is fixed.
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-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.
14
3.3 NetBeans IDE
NetBeans is a software development written in Java. The NetBeans Platform allows applications
to be developed from a set of modular software components called modules. Applications based
on the NetBeans Platform, including the NetBeans integrated development environment (IDE),
can be extended by third party developers.
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.
15
3.4 Overview of Servlet technology
3.4.1 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 were many disadvantages of this technology. We have discussed these disadvantages below.
There are many interfaces and classes in the servlet API such as Servlet, Generic Servlet, HTTP
Servlet, Servlet Request, Servlet Response etc.
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.
16
3.5 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.
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.
17
3.6 Java database connectivity
JDBC is a Java database connectivity technology (Java Standard Edition platform) from Oracle
Corporation. This technology is an API for the Java programming language that defines how a
client may access a database. It provides methods for querying and updating data in a database.
JDBC is oriented towards relational databases. A JDBC-to-ODBC bridge enables connections to
any ODBC-accessible data source in the JVM host environment.
The JDBC library includes APIs for each of the tasks mentioned below that are commonly
associated with database usage.
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
All of these different executables are able to use a JDBC driver to access a database, and
take advantage of the stored data
18
Figure 3.6: JDBC Architecture.
3.7 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.
19
3.8 jQuery
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document
traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-
use API that works across a multitude of browsers. With a combination of versatility and
extensibility, jQuery has changed the way that millions of people write JavaScript.
jQuery, at its core, is a Document Object Model (DOM) manipulation library. The DOM is a tree-
structure representation of all the elements of a Web page. jQuery simplifies the syntax for finding,
selecting, and manipulating these DOM elements. For example, jQuery can be used for finding an
element in the document with a certain property (e.g. all elements with an h1 tag), changing one
or more of its attributes (e.g. color, visibility), or making it respond to an event (e.g. a mouse click).
jQuery also provides a paradigm for event handling that goes beyond basic DOM element selection
and manipulation. The event assignment and the event callback function definition are done in a
single step in a single location in the code. jQuery also aims to incorporate other highly used
JavaScript functionality (e.g. fade ins and fade outs when hiding elements, animations by
manipulating CSS properties).
Separation of JavaScript and HTML: The jQuery library provides simple syntax for
adding event handlers to the DOM using JavaScript, rather than adding HTML event
attributes to call JavaScript functions. Thus, it encourages developers to completely
separate JavaScript code from HTML markup.
Brevity and clarity: jQuery promotes brevity and clarity with features like chainable functions
and shorthand function names.
Extensibility: New events, elements, and methods can be easily added and then reused as a
plugin.
20
Chapter 4
SYSTEM DESIGN
Admin Log In
Add Products
Update Product
Details
Manage/Delete
Products
Approve Websites
Moderate Website
Management
View Profits
Delete Orders
21
4.1.2 Customer/user subsystem user case diagram
Admin Logs in
User Log In
Management
Change Status on
Verification
User Registers
User Log In
23
4.2 Package Diagram
Domain
LoginServlet.java
RegisterServlet.java
view
BuyItems.java
index.jsp
Order.java
admin_.jsp ProductBean.java
addToCart.jsp UserBean.java
AddProduct.java
viewProducts.jsp
DeleteProduct.java
searchLoad.jsp
product.jsp
admin_Dashboard.jsp
Images.db
User.db
User_Details.db
Order.db
Sales.db
Expenses.db
24
4.3 List of Tables:
1. product Table
3. category table
4. subcategory table
25
5. user table
6. administrators table
7. company table
8. expenses table
9. sales table
1. index.jsp
28
Figure 5.1: Alpha Book Store home page when no user login.
2. index.jsp
Figure 5.2: Alpha Book Store home page when login form extended.
29
3. index.jsp
4. userinfo.jsp
30
5. userinfo.jsp
6. viewProduct_.jsp
Figure 5.6: User Filtering the list of Products (Here the Filter is Engineering(Computer/IT)).
31
7. product.jsp
8. addToCart.jsp
Figure 5.9: User have to fill their details before purchasing items.
10. buyItems.jsp
Figure 5.10: User have filled their details here and ready to go.
33
11. userinfo.jsp
12. showMyBill.jsp
Figure 5.12: User has confirmed their order and its status is pending.
34
13. showMyBill.jsp
Figure 5.13: User order has been approved and ready to deliver.
14. showMyBill.jsp
Figure 5.14: User order has been delivered , now user can print their bill.
35
15. showMyBill_Print.jsp
16. index.jsp
18. admin_Performance.jsp
Figure 5.19: The Alpha Book Store performance through Line graph and Pie Chart.
20. admin_Performance.jsp
Figure 5.20: Items viewed by Category through pie chart and product sold through line graph.
38
21. admin_Performace.jsp
Figure 5.21: Top 10 product sold and views on Alpha Book Store.
22. admin_addProduct.jsp
24. admin_addProduct_2.jsp
Figure 5.24: Admin has added the Category and SubCategory name of the book.
40
25. admin_addProduct_3.jsp
Figure 5.25: Admin has added the book name and its search tag.
26. admin_addProduct_4.jsp
Figure 5.26: Admin has added the book price, quantity and a summary.
41
27. uploadImage.jsp
28. admin_pendingOrders.jsp
Figure 5.28: List of product pending and need an approval from the admin.
42
29. admin_approvedOrders.jsp
30. admin_settings.jsp
Figure 5.30: Admin setting page, here admin can add a user to admin panel.
43
31. admin_settings.jsp
Figure 5.31: Admin setting page, here admin can delete the selected category or subcategory.
44
Chapter 6
CONCLUSION AND FUTURE WORK
6.1 Conclusion
The software development is never completed. There is always a need for modification. There
could have been other approaches to implement the system. I have tried to my level best to make
the system an interactive as possible.
The developed system is flexible, and changes whenever can be made easy. Using the facilities
and functionalities of J2EE and jsp, the website has been developed in a neat and simple manner,
thereby reducing the operators work. The speed and accuracy are maintained in proper way. The
user-friendly nature of this website developed in J2EE and jsp is very easy to work with both for
the admin as well as other users with little knowledge of computer.
This project can be easily implemented under various situations. We can add new features as and
when we require. Reusability is possible as and when require in this project. There is flexibility
in all the modules.
We can also include online payment services to this project using PayPal. This will help
customers to pay online for their purchases using Credit/Debit card. There are many features
which could be added to this project for making this project more productive.
45
BIBLIOGRAPHY
Reference Books
Thomas A. Powell, The Complete Reference to HTML5 and CSS3, McGraw Hill
Kathy Seirra and Bert Bates, Head First Java and Head First JSPs and Servlets, McGraw Hill
Website Reference
www.oracle.com/technetwork
www.tutorialspoint.com
www.w3schools.com
www.javatpoint.com
www.mysirg.com
www.youtube.com
www.youtube.com/udacity
46
APPENDIX
Modules and files used in Alpha Book Store
47
Modules and files used in Alpha Book Store
48
Modules and files used in Alpha Book Store
49
web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-
app_3_1.xsd">
<servlet>
<servlet-name>addAnAdministrator</servlet-name>
<servlet-class>admin.addAnAdministrator</servlet-class>
</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>
50
</servlet>
<servlet>
<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>
</servlet>
<servlet>
<servlet-name>buyItems</servlet-name>
<servlet-class>product.buyItems</servlet-class>
</servlet>
51
<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>
<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>
52
<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>
</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>
53
<url-pattern>/changeProductStatus</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>addCategory</servlet-name>
<url-pattern>/addCategory</url-pattern>
</servlet-mapping>
<servlet-mapping>
<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>
54
</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>
55
JSP File
index.jsp
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="database.DB_Conn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Alpha BookStores</title>
<!-- Default Stylesheets -->
<%@include file="includesPage/_stylesheets.jsp" %>
<link rel="stylesheet" href="css/slider.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/slider.js"></script>
<script type="text/javascript" >
// This is the script for the banner slider
$(document).ready(function() {
$('#slider').s3Slider({
timeOut: 7000
});
});
</script>
<script type="text/javascript" src="js/myScript.js"></script>
</head>
<body>
<%
if (session.getAttribute("user") == null ){// THen new user, show join now
%>
<jsp:include page="includesPage/_joinNow.jsp"></jsp:include>
<%
}else {
56
%>
<jsp:include page="includesPage/_logout.jsp"></jsp:include>
<%
}
%>
<%@include file="includesPage/_search_navigationbar.jsp" %>
<%@include file="includesPage/_facebookJoin.jsp" %>
<div id = "banner">
<div class="container_16">
<div class="grid_16" style="padding-left: 20px; " id="slider">
<ul id="sliderContent">
<!-- Duplicate this code for each image -->
<li class="sliderImage" style="display: none; ">
<img src="images/banner/a2.jpg" width="900" height="300" />
<span class="top" style="display: none; ">
<strong>Alpha BookStore...</strong>
<br>Alpha BookStore provides Engineering,Medical,Management and School books
available now at your doorsteps.
</span>
</li>
<div class="clear sliderImage"></div>
</ul>
</div>
</div>
</div>
<div class="container_16">
<div id = "contents">
<!-- LeftSide -->
<%
Connection c = new DB_Conn().getConnection();
Statement st = c.createStatement();
String getCategory = "SELECT * FROM `category` ";
ResultSet rs = st.executeQuery(getCategory);
57
%>
<div id="leftside" class="grid_3">
<div>
<ul id="leftsideNav">
<li><a href="#"><strong>Categories</strong></a></li>
<%
while (rs.next()){
String category = rs.getString ("category_name");
%>
<li><a href="viewProducts_.jsp"><%= category %></a></li>
<%
}
%>
</ul>
</div>
<div class="adv">
<h2><br/>This is The Header of an Advertisement</h2>
<p>We offer Advertisement display here </p>
</div>
</div>
</div>
<!-- Middle -->
<div id="middle"class="grid_13">
<jsp:include page="includesPage/mainHeaders/topMostViewedProducts_4.jsp"></jsp:include>
</div>
<!--The Middle Content Div Closing -->
</div>
<jsp:include page="includesPage/_footer.jsp"></jsp:include>
</body>
</html>
58
Java file
DB_Conn.java
package database;
import java.sql.*;
public class DB_Conn {
private String database="alpha", username = "root", password = "";
private Connection con;
public Connection getConnection() throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/"+database+"",""+username+"
",""+password+"");
return con;
}
public String getDatabase() {
return database;
}
public void setDatabase(String database) {
this.database = database;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
59
60