You are on page 1of 80

ABSTRACT

This project is a web-based shopping system for an existing shop.The project


objective is to deliver the online shopping application intoandroidplatform.

This project is an attempt to provide the advantages of online shopping


tocustomersofarealshop.Ithelpsbuyingtheproductsintheshopanywhere through internet
by using an android device. Thus, the customerwill get the service of online shopping
and home delivery from his favoriteshop. This system can be implemented to any
shop in the locality or tomultinationalbrandedshopshavingretailoutletchains.

If shops are providing an online portal where their customers can


enjoyeasyshoppingfromanywhere,theshopswon’tbelosinganymorecustomers to the
trending online shops such as flipcart or ebay. Since
theapplicationisavailableintheSmartphoneitiseasilyaccessibleandalwaysavailable
LISTOFFIGURES

1.1 ADMINMODULE 5

1.2MANAGEMODERATORS 6
1.3MANAGEPRODUCTS 8
1.4MANAGEUSERS 9
1.5MANAGEORDERS 10
1.5MODERATOR MODULE 11
1.7 USERMODULE 12
E-RDIAGRAMS&DFD

3.5 LOGIN 30
3.6USERDETAILS 30
3.7PRODUCTDETAILS 31
3.8PRODUCTORDERS 31
3.9COMPLETEDIAGRAM 32
3.10 LOGIN DFD 35

3.11 REGISTRATIONDFD 36

3.12 ADMINDFD 37

3.13 MODERATORDFD 38
LISTOFTABLES

3.1 LOGINTABLE 28

3.2 USERDETAILS 28

3.3 PRODUCT DETAILS 29

3.4 PRODUCT ORDERS 29

iv
ACKNOWLEDGEMENT

I take this occasion to thank God, almighty for blessing us withhis

grace and taking our endeavor to a successful culmination.I extendmy sincere and

heartfelt thanks to our esteemed guide, Mrs. PREETHA S,for providing me with

the right guidance and advice at the crucial juncturesand for showing me the right

way. I extend my sincere thanks to ourrespected Head of the division Mr.

PRAMOD PAVITHRAN, for allowingus to use the facilities available. I would

like to thank the other facultymembers also, at this occasion. Last but not the

least, I would like to thankmy friends and family for the support and

encouragement they have givenmeduringthe course of our work.

SHIBIN
CHITTILNIDHEESH
CHITTILRISHIKES
EMR

v
TABLEOFCONTENTS

ABSTRACT i
LIST OF FIGURE ii
LIST OFTABLES iv
ACKNOWLEDGEMENT v

1. INTRODUCTION PAGE
1.1 PROJECTOBJECTIVES 1
1.2 PROJECTOVERVIEW 2
1.3 PROJECTSCOPE 2
1.4 STUDYOF SYSTEMS 3
1.4.1 MODULES 3
1.4.1.1 ADMIN 3
1.4.1.2 MODERATOR 11
1.4.1.3 USER 12

2. SYSTEMANALYSIS 15
2.1 EXISTINGSYSTEM 15
2.2 PROPOSEDSYSTEM 16
2.3 SYSTEMREQUIREMENTSPECIFICATION 16
2.3.1 GENERALDESCRIPTION 16
2.3.2 SYSTEMOBJECTIVES 17
2.3.3 SYSTEMREQUIREMENTS 17
2.3.3.1 NONFUNCTIONAL REQUIREMENT 18
2.3.3.2 FUNCTIONALREQUIREMENT 19

3. SYSTEMDESIGN 23

3.1 INPUTANDOUTPUTDESIGN 24

3.1.1 INPUT DESIGN 24

3.1.2 OUTPUT DESIGN 24

3.2 DATABASE 25

3.3 SYSTEMTOOLS 25

3.3.1 FRONT END 26

3.3.2 BACKEND 27

3.4 TABLES 28

3.5 E-RDIAGRAMS 30

3.6 DATAFLOWDIAGRAMS (DFD) 32

3.7 SCREENSHOTS 39
3.8 SAMPLECODE 47

4. CONCLUSION 67

REFERENCES 69
CHAPTER1

INTRODUCTION
Thisprojectisaweb basedshoppingsystemforan existingshop.
Theprojectobjectiveistodelivertheonlineshoppingapplicationintoandroidplatform.

Online shopping is the process whereby consumers directly buy goods orservices
from a seller in real-time, without an intermediary service, overthe Internet. It is
a form of electronic commerce. This project is an attemptto provide the
advantages of online shopping to customers of a real shop.It helps buying the
products in the shop anywhere through internet byusing an android device. Thus
the customer will get the service of onlineshoppingand home
deliveryfromhisfavoriteshop

1.1 PROJECTOBJECTIVE:

The objective of the project is to make an application in androidplatform


to purchase items in an existing shop. In order to build such anapplication
complete web support need to be provided. A complete andefficient web
application which can provide the online
shoppingexperienceisthebasicobjectiveoftheproject.Thewebapplicationcanbeim
plementedintheformofanandroidapplicationwithwebview.
1.2 PROJECTOVERVIEW:

The central concept of the application is to allow the customer to


shopvirtually usingtheInternetandallow customers tobuy theitems andarticles of
their desire from the store. The information pertaining to theproductsare
storesonanRDBMS at the server side(store).

TheServerprocessthecustomersandtheitemsareshippedtotheaddresssubmittedbythe
m.Theapplicationwasdesignedintotwomodules first is for the customers who wish
to buy the articles. Second isfor the storekeepers who maintains and updates the
information
pertainingtothearticlesandthoseofthecustomers.Theenduserofthisproductisa
departmental store where the application is hosted on the web and
theadministrator maintainsthe database. The applicationwhichis
deployedatthecustomerdatabase,thedetailsoftheitemsarebroughtforwardfrom the
database for the customer view based on the selection throughthe menu and the
database of all the products are updated at the end ofeach transaction. Data entry
into the application can be done throughvarious screens designed for various
levels of users. Once the authorizedpersonnel feed the relevant data into the
system, several reports could begeneratedasper the security.

1.3 PROJECTSCOPE:
This system can be implemented to any shop in the locality or
tomultinationalbrandedshopshavingretailoutletchains.Thesystemrecommends a
facility to accept the orders 24*7 and a home deliverysystem which canmake
customershappy.
If shops are providing an online portal where their customers canenjoy
easy shopping from anywhere, the shops won’t be losing any morecustomers to
the trending online shops such as flipcart or ebay. Since
theapplicationisavailableintheSmartphoneitiseasilyaccessibleandalwaysavailable.

1.4 STUDYOFTHESYSTEM

1.4.1 MODULES:
Thesystemaftercarefulanalysishasbeenidentifiedtobepresentedwiththefollowingmod
ulesand roles.
Themodulesinvolvedare:

 Administrator
 Moderators
 Users

1.4.1.1 ADMINISTRATOR:
The administrator is the super user of this application. Only adminhave
access into this admin page. Admin may be the owner of the shop.The
administrator has all the information about all the users and about allproducts.

Thismoduleisdividedintodifferent sub-modules.

1. ManageModerators
2. ManageProducts
3. ManageUsers
4. ManageOrders
Fig1.1:Adminmodule

MANAGEMODERATOR
Fig1.2:ManageModerator
 AddModerator

Only admin is having the privilege to add a moderator. A moderator


canbeconsideredasastaffwhomanagestheordersorownerofagroupofproducts.

 Block moderator
Admincanrestrictamoderatorfrommanagingtheordersbyblockingthem.Admin
canunblock ablockeduser if needed.

 RemoveModerator

Adminhasprivilegetodeleteamoderatorwhowasadded.

 Searchmoderator:

All existing moderatorscan be viewed by the administrator as a list. Ifthere is


number of moderators and admin need to find one of them, theadmincan
searchfor amoderator byname.

MANAGEPRODUCTS
Fig1.3:ManageProducts

 AddProducts
The shopping cart project contains different kind of products. The productscan be
classified into different categories by name. Admin can add
newproductsintotheexistingsystem withallitsdetailsincludinganimage.

 DeleteProducts

Administrator can delete the products based on the stock of that


particularproduct.

 Searchproducts
Adminwillhavea listviewofalltheexistingproducts.Hecanalsosearchfora particular
productbyname.

MANAGEUSER

Fig1.4:ManageUser
 ViewUsers

Theadminwillhavealistviewofalltheusersregisteredinthesystem.Admincanviewallthe
detailsofeachuserinthelistexcept password.

 AddUsers

Adminhasprivilegestoaddauserdirectlybyprovidingthedetails.

 Delete&Block Users
Administrator has a right to delete or block a user. The default status of anew
user registered is set as blocked. The admin must accept the
newuserbyunblockinghim.

MANAGEORDERS

Fig1.5:ManageOrders
 ViewOrder
AdministratorcanviewtheOrderswhichisgeneratedbytheusers.Hecanverifythedetails
of thepurchase.

 Deleteorder
Admincandeleteorderfromtheorderslistwhentheproductistakenfordelivery.

1.4.1.2 MODERATORS

Fig1.6:ModeratorModule

A moderator is considered as a staff who can manage orders for the timebeing.
As a future update moderator may give facility to add and managehis own
products . Moderators can reduce the work load of admin.
Nowmoderatorhasalltheprivilegeanadminhavingexceptmanagingother
moderators.Hecanaddproductsandusers.Hecanalsochecktheordersandedithis
profile.

 Manageproducts
 Manageusers
 Manageorders

1.4.1.3 USERS

Fig1.7: User Module

 Registration
A new user will have toregister in the system by providing essentialdetails in
order to view the products in the system. The admin must acceptanewuser
byunblockinghim.

 Login

Ausermustloginwithhisusernameandpasswordtothesystemafterregistration.

 ViewProducts

User can view the list of products based on their names after successfullogin. A
detailed description of a particular product with product name,productsdetails,
productimage,price canbeviewed byusers.

 SearchProduct

Userscan searchfor aparticularproduct inthe listbyname.

 Addtocart:

The user can add the desired product into his cart by clicking add to cartoptionon
the product.

He can view his cart by clicking on the cart button. All products added bycart can
be viewed in the cart. User can remove an item from the cart byclickingremove.
 Submit Cart:

After confirming the items in the cart the user can submit the cart byproviding a
delivery address.On successful submitting the cart will becomeempty.

 History
Inthe historytheuserwillhavea viewofpendingorders.

 EditProfile

Theusercanviewandedittheprofile.
CHAPTER2

SYSTEMANALYSIS

Systemanalysisistheprocessofgatheringandinterpretingfacts,diagnosingproblemsa
ndusingtheinformationtorecommendimprovementsonthesystem. System analysis
is a problem solvingactivity that requires intensive communication between the
system usersandsystemdevelopers.

Systemanalysisorstudyisanimportantphaseofanysystemdevelopment process. The


system is viewed as a whole,the inputs areidentifiedand the system is subjected
toclosestudytoidentifytheproblemareas.Thesolutionsaregivenasaproposal.Theprop
osalis reviewed on user request and suitable changes are made. This loopendsas
soonastheuser is satisfiedwith theproposal.

2.1 EXISTINGSYSTEM

The current system for shopping is to visit the shop manually and from
theavailable product choose the item customer want and buying the item
bypaymentof thepriceof the item.

1. Itislessuser-friendly.
2. Usermustgotoshopandselectproducts.
3. Itisdifficulttoidentifytherequiredproduct.
4. Descriptionoftheproductlimited.
5. Itisa timeconsumingprocess
6. Notinreachofdistantusers.

2.2 PROPOSEDSYSTEM

Intheproposedsystemcustomerneednotgototheshopforbuying the products.


He can order the product he wish to buy through
theapplicationinhisSmartphone.Theshopownerwillbeadminofthesystem.Shopown
ercanappointmoderatorswhowillhelpownerinmanagingthecustomersandproductor
ders.Thesystemalsorecommendsahome deliverysystemfor thepurchasedproducts.

2.3 SYSTEMREQUIREMENTSPECIFICATION

2.3.1 GENERALDESCRIPTION

ProductDescription:

Thesystemconsists
oftwoparts .Awebapplicationwhichcanprovidetheonlineshoppingserviceandanandroida
pplicationforthecustomerto
access the web service from his Smartphone. Web application should beable to
help the customer for selecting his item and to help the owner
inmanagingtheordersfromthe customers.

ProblemStatement:

Asonlineshoppingbecameatrendnowadaystheregularshopsarelosingtheircustomers
toonlinebrands.Customershaveeffortlessshoppingexperienceandsavingtimethroug
hshoppingonline.Forcompeting withthoseonlinebrands,Ifshopsareproviding
anonlineportalwheretheircustomerscanshopthroughinternetandgettheproductsatth
eirdoors it willincrease thenumber ofcustomers.

2.3.2 SYSTEMOBJECTIVES

 To provideanandroid
applicationforonlineshoppingofproductsinanexistingshop.
 Toprovide aonlineshoppingwebsiteforthesameshop.

2.3.3 SYSTEMREQUIREMENTS
2.3.3.1 NONFUNCTIONALREQUIREMENTS

i. EFFICIENCYREQUIREMENT

When an online shopping cart android application implemented


customercanpurchase productin anefficientmanner.

ii. RELIABILITYREQUIREMENT

The system should provide a reliable environment to both customers


andowner.Allordersshould bereachingattheadminwithoutanyerrors.

iii. USABILITYREQUIREMENT

Theandroidapplicationisdesignedforuserfriendlyenvironmentandeaseof use.

iv. IMPLEMENTATIONREQUIREMENT

Implementation of the system using css and html in front end with jsp asback end
and it will be used for database connectivity. And the databasepart is developed
by mysql. Responsive web designing is used for makingthewebsite compatiblefor
anytype of screen.

v. DELIVERYREQUIREMENT

Thewholesystemisexpectedtobedeliveredinfourmonthsoftimewith
aweeklyevaluationbytheproject guide.

2.3.3.2 FUNCTIONALREQUIREMENTS

USER

 USER

LOGINDescriptionoff

eature

This feature used by the usertologininto system. A user must loginwith his user
name and password to the system after registration. If theyareinvalid, theuser
notallowed toenterthe system.

Functionalrequirement

- Usernameandpasswordwillbeprovidedafteruserregistrationisconfirmed.
- Passwordshouldbehiddenfrom otherswhiletypingitinthefield

 REGISTER NEW

USERDescription offeature
A new user will have toregister in the system by providing essentialdetails in
order to view the products in the system. The admin must acceptanewuser
byunblockinghim.

Functionalrequirement

- System mustbeabletoverifyandvalidate information.


- Thesystemmustencryptthepasswordofthecustomertoprovidesecurity.
 PURCHASINGANITEM

Description offeature

The user can add the desiredproduct into his cart by clicking add to cartoption on
the product. He can view his cart by clicking on the cart button.All products
added by cart can be viewed in the cart. User can remove anitem from the cart by
clicking remove. After confirming the items in the
carttheusercansubmitthecartbyprovidingadeliveryaddress.Onsuccessfulsubmitting
the cartwill becomeempty.

Functionalrequirement

- Systemmustensurethat,onlyaregisteredcustomercanpurchaseitems.
ADMIN

 MANAGE

USERDescription

offeature

Theadministratorcanadduser,deleteuser,viewuserandblockuser.

 MANAGE

MODERATORDescription

offeature

Theadministratorcanaddmoderator,deletemoderator,blockmoderatorandsearchfor
amoderator.

 MANAGE

PRODUCTSDescription

offeature

Theadministratorcanaddproduct,deleteproductandviewproduct.

 MANAGE

ORDERSDescription
offeature

The administrator can view orders and delete

orders.Functionalrequirements

-Thesystemmustidentifytheloginof theadmin.
-Adminaccountshouldbesecuredsothatonlyowneroftheshopcanaccessthataccount

MODERATOR

Descriptionoffeatures

A moderator is considered as a staff who can manage orders for the timebeing.
As a future update moderator may give facility to add and managehis own
products. Moderators can reduce the work load of admin. Nowmoderator has all
the privilege of an admin having except managing othermoderators. He can
manage users and manage products. He can alsochecktheorders andedit his
profile.

Functionalrequirement

-Thesystemmustidentifytheloginofamoderator.
CHAPTER3

SYSTEMDESIGN

Systemdesignisthe solution forthecreationofanew system.This phase


focuses on the detailed implementation of the feasible
system.Itemphasisontranslatingdesign.Specificationstoperformancespecification.
Systemdesignhas twophasesofdevelopment

 Logicaldesign
 Physicaldesign

Duringlogicaldesignphasetheanalystdescribesinputs(sources),outputs(destinations
),databases(datasores)andprocedures(dataflows) all in a format that meets the
userrequirements. The analyst alsospecifies the needs of the userat a level that
virtually determines theinformation flow in and out of the system and the data
resources.
Herethelogicaldesignisdonethroughdataflowdiagramsanddatabasedesign. The
physical designisfollowedbyphysicaldesignorcoding.Physicaldesign
producestheworkingsystembydefiningthedesignspecifications,whichspecify

exactlywhatthecandidatesystemmustdo.
Theprogrammerswritethenecessaryprogramsthatacceptinputfromtheuser,perform
necessary processing on accepted data and produce the required
reportonahardcopyor displayit on the screen.

3.1 INPUT ANDOUTPUTDESIGN

3.1.1 INPUTDESIGN:

Inputdesignisthelinkthattiestheinformationsystem intotheworldofits

users.The input design involves


determiningtheinputs,validatingthedata,minimizingthedataentryandprovidesamult
i-userfacility.Inaccurate inputs are the
mostcommoncauseoferrorsindataprocessing.Errorsenteredbythedataentry
operatorscanbecontrolled by input design.Theuser-originated inputsare converted
to acomputer based format in the input design. Input data are collected
andorganizedintogroups ofsimilardata.Onceidentified,theappropriateinput media
are selected for processing. All the input data are validatedand if any data violates
any conditions, theuseriswarnedbyamessage.
Ifthedatasatisfiesalltheconditions,itis transferred tothe appropriate tables in the
database. In this project the student detailsare to be entered at the time of
registration. A page is designed for thispurpose which is userfriendlyand easy to
use.The design is
donesuchthatusersgetappropriatemessageswhenexceptionsoccur.

3.1.2 OUTPUTDESIGN:
Computer output is the most important and direct source ofinformation
totheuser.Outputdesignisaveryimportantphasesincetheoutputneedstobeinanefficie
ntmanner.Efficientandintelligibleoutputdesignimprovesthesystemrelationshipwith
theuserandhelpsindecisionmaking.Allowingtheusertoviewthesamplescreenisimpo
rtantbecause the user is the ultimate judge of the quality of output.The
outputmoduleofthissystemis theselectednotifications.

3.2 DATABASE

DATABASEDESIGN:

Databases are the storehouses ofdata used in the software systems. Thedata is
stored intablesinsidethedatabase.Severaltables
arecreatedforthemanipulationofthe data for the system.Two essentialsettingsfor
adatabaseare

- thefieldthatisuniqueforalltherecordoccurrences.

-thefieldusedtosetrelationbetweentables.

Normalizationisatechniquetoavoidredundancyinthetables.

3.3 SYSTEMTOOLS

Thevarioussystemtoolsthathavebeenusedindevelopingboththefrontendandthebacken
dof theprojectarebeingdiscussedinthischapter.
3.3.1.FRONTEND:

JSP,HTML,CSS,JAVASCRIPT,ANDROIDareutilizedtoimplementthefrontend.

JavaServerPages(JSP)

Different pages in the applications are designed using jsp. A Java ServerPages
component is a type of Java servlet that is designed to fulfil the roleof a user
interface for a Java web application. Web developers write JSPsas text files that
combine HTML or XHTML code, XML elements, andembedded JSP actions and
commands. Using JSP, one can collect inputfromusers through web page.

HTML(HyperTextMarkupLanguage)

HTMLisasyntaxusedtoformatatextdocumenton theweb.

CSS(CascadingStyleSheets)

CSS is astyle sheet languageused for describing thelook


andformattingofadocument writteninamarkuplanguage.

JavaScript

JSisadynamiccomputerprogramminglanguage.Itismostcommonlyusedaspartofwebbro
wsers,whoseimplementationsallowclient-side
scriptstointeractwiththeuser, control the browser,

communicateasynchronously,andalterthedocumentcontentthatisdisplayed.

JavaScriptisusedtocreatepopupwindowsdisplayingdifferentalertsin
thesystemlike“Userregisteredsuccessfully”,”Productaddedtocart”etc.

Android

Theapplicationisdeliveredtocustomerthroughanandroidapplication.Soandroidplatfor
misusedtodevelop theuser application.

3.3.2 BACKEND

ThebackendisimplementedusingMySQLwhichisusedtodesignthedatabases.

MySQL

MySQListheworld'ssecondmost widelyusedopen-source relationaldatabase


management system (RDBMS).The SQL phrase stands
forStructuredQueryLanguage.

An application software called Navicat was used to design the tables inMySQL.
3.4 TABLES

 LOGIN

Fig3.1: LoginTable

 USERDETAILS
Fig3.2: User Details Table

 PRODUCT DETAILS

Fig3.3:ProductDetailsTable

 PRODUCT ORDERS

Fig3.4:ProductOrderstable
3.5E-RDIAGRAMS
 LOGIN

Fig3.5: Login

 USERDETAILS

Fig3.6: User Details


 PRODUCTDETAILS

Fig3.7:ProductDetails

 PRODUCT ORDERS

Fig3.8:ProductOrders
OnlineShoppingSystem

 COMPLETEDIAGRAM

Fig3.9:CompleteDiagram

3.6 DATAFLOWDIAGRAM

AData Flow Diagram(DFD) is astructuredanalysis and designtool that can


be used for flowcharting.
ADFDisanetworkthatdescribestheflowofdataandtheprocessesthatchangeortransfor
mthedatathroughoutasystem. This network is constructed byusingasetof
symbolsthatdonotimplyany
physicalimplementation.Ithasthepurposeofclarifyingsystem

DepartmentofComputerScience,CUSAT Page42
OnlineShoppingSystem

DepartmentofComputerScience,CUSAT Page43
OnlineShoppingSystem

requirements and identifying major transformations. So it is the startingpoint of


the design phase that functionally decomposes the requirementsspecifications
down to the lowest level of
detail.DFDcanbeconsideredtoanabstractionofthelogicofan information-
orientedoraprocess-orientedsystemflow-chart.Forthesereasons DFD’s
areoftenreferred toas logical dataflowdiagrams.

EXTERNALENTITY

An external entity is a source or destination of a data flow. Only thoseentities


which originate or receive data are represented on a data flowdiagram.The
symbol usedis arectangular box.

PROCESS

A process shows a transformation or manipulation of data flowwithin


thesystem.Thesymbol used is anoval shape.

DATAFLOW

DepartmentofComputerScience,CUSAT Page44
OnlineShoppingSystem

Thedata flow showsthe flow of informationfrom asource to itsdestination. Data


flowisrepresentedbyaline,witharrowheadsshowingthedirectionofflow.
Informationalwaysflowstoorfromaprocessandmaybewritten,verbalorelectronic.Ea
chdataflowmaybereferencedbytheprocessesordatastoresatits head andtail,or
byadescriptionofitscontents.

DATASTORE

A data store is a holding place for information within the system: It isrepresented
by anopenendednarrowrectangle.Datastoresmaybelong-
termfilessuchassalesledgers,ormaybeshort-termaccumulations: for example
batches of documents that are waiting to beprocessed. Each data store should
begiven a reference followed by anarbitrarynumber.

 LOGIN DFD

DepartmentofComputerScience,CUSAT Page44
OnlineShoppingSystem

Fig3.10: LoginDFD

 REGISTRATIONDFD

DepartmentofComputerScience,CUSAT Page45
OnlineShoppingSystem

Fig3.11: RegistrationDFD

 ADMINDFD

DepartmentofComputerScience,CUSAT Page46
OnlineShoppingSystem

Fig3.12: AdminDFD

DepartmentofComputerScience,CUSAT Page47
OnlineShoppingSystem

 MODERATOR DFD

Fig3.13:ModeratorDFD

DepartmentofComputerScience,CUSAT Page48
OnlineShoppingSystem

3.7 SCREENSHOTS

 LOGIN

 REGISTRATION

DepartmentofComputerScience,CUSAT Page49
OnlineShoppingSystem

 HOME

DepartmentofComputerScience,CUSAT Page50
OnlineShoppingSystem

 ADMINHOME

DepartmentofComputerScience,CUSAT Page51
OnlineShoppingSystem

 ADMINPRODUCT

DepartmentofComputerScience,CUSAT Page52
OnlineShoppingSystem

 ADMINORDER

DepartmentofComputerScience,CUSAT Page53
OnlineShoppingSystem

 MODERATOR HOME

DepartmentofComputerScience,CUSAT Page54
OnlineShoppingSystem

 USERHOME

DepartmentofComputerScience,CUSAT Page55
OnlineShoppingSystem

 USER CART

DepartmentofComputerScience,CUSAT Page56
OnlineShoppingSystem

3.8 SAMPLECODE

 LOGINPAGE

<%@includefile="template/top.jsp"%>

<%@includefile="template/menu_public.jsp"%>

<%@includefile="template/body_start.jsp"%>

<formid="form"action="loginbaseselect.jsp">

DepartmentofComputerScience,CUSAT Page57
OnlineShoppingSystem

<table>

<tr>

<td><inputtype="text"name="uname"id="uname"plac
eholder="username"required=""/> </td>

</tr>

<tr>

<td><inputtype="password"name="upass"id="upass"place
holder="password" required=""/></td>

</tr>

<tr>

<td><buttonclass="button"type="submit"id="search-
submit">Login</button> </td>

<td><divid="result"></div></td>

</tr>

</table>

</form>

<scripttype="text/javascript">

<%

DepartmentofComputerScience,CUSAT Page58
OnlineShoppingSystem

if (request.getParameter("login") != null
&&request.getParameter("login").contentEquals("failed")){

%>

alert("LoginFailed!!!");

<% }

%>

<%

if (request.getParameter("login") != null
&&request.getParameter("login").contentEquals("dissabled")){

%>

alert("UserBlocked!!!");

<% }

%>

<%

if (request.getParameter("login") != null
&&request.getParameter("login").contentEquals("unknown")){

%>

alert("Unknownuser!!!");

<% }

DepartmentofComputerScience,CUSAT Page59
OnlineShoppingSystem

%>

</script>

%@includefile="template/body_end.jsp"%

 REGISTRATION

<%@pageimport="DataBase.DB"%>

<%@pageimport="java.sql.ResultSet"%>

<%@includefile="template/top.jsp"%>

<%@includefile="template/menu_public.jsp"%>

<%@includefile="template/body_start.jsp"%>

<h2class="title"><ahref="#">Register</a></h2>

<divclass="entry">

<formaction="dbregister.jsp"onsubmit="returncheck()">

<table>

<tr>

<td>UserName

</td>

DepartmentofComputerScience,CUSAT Page60
OnlineShoppingSystem

<td><inputtype="text"required=""name="uname"id="uname"
/>

</td>

</tr>

<tr>

<td>Password

</td>

<td><inputtype="password"required=""name="upass"id="u
pass"/>

</td>

</tr>

<tr>

<td>LoginName

</td>

<td><inputtype="text"required=""name="lname"id="lname"/>

</td>

</tr>

DepartmentofComputerScience,CUSAT Page61
OnlineShoppingSystem

<tr>

<td>Email

</td>

<td><inputtype="email"name="emailid"id="emailid"/>

</td>

</tr>

<tr>

<td>MobileNo.

</td>

<td><inputtype="text"name="mobno"id="mobno"/>

</td>

</tr>

<tr>

<td>

</td>

DepartmentofComputerScience,CUSAT Page62
OnlineShoppingSystem

<td><buttonclass="button"type="submit">Register</button>

</td>

</tr>

</table>

</form>

</div>

<scripttype="text/javascript">

<%

if(request.getParameter("reg")!=null&&
request.getParameter("reg").contentEquals("failed")){

%>

alert("RegistrationFailed!!!");

<% }

%>

<%

DepartmentofComputerScience,CUSAT Page63
OnlineShoppingSystem

if (request.getParameter("reg") != null
&&request.getParameter("reg").contentEquals("success")){

%>

alert("RegistrationCompleted")

<% }

%>

</script>

%@includefile="template/body_end.jsp"%

 DBREGISTRATION

<%@pageimport="config.Config"%>

<%@pageimport="java.io.File"%>

<%@pageimport="java.sql.ResultSet"%>

<%@pageimport="DataBase.DB"%>

<%

if(DB.executeUpdate("insertintologinvalues("

+"null"+",'"
DepartmentofComputerScience,CUSAT Page64
OnlineShoppingSystem

+request.getParameter("uname")+"',SHA1('"

+request.getParameter("upass")+"'),'"

+"user" +"','"

+"false"+ "')")){

ResultSetr=DB.executeQuery("selectmax(uid)fromlogin");r.next();

Stringuid=r.getString(1);

if(DB.executeUpdate("insertintouserdetailsvalues("

+uid +",'"

+request.getParameter("lname")+"','"

+request.getParameter("emailid")+"','"

+request.getParameter("mobno")+"')")){

//thiscodegeneratestheqrcodeinsidetheQR_Codefolderinthec drive

response.sendRedirect("index.jsp?reg=success");

}else {

response.sendRedirect("register.jsp?reg=failed");

DepartmentofComputerScience,CUSAT Page65
OnlineShoppingSystem

%>

 LOGINBASESELECTION

<%@pageimport="DataBase.DB"%>

<%@pageimport="java.sql.ResultSet"%>

<%

String uname =

request.getParameter("uname");Stringupass=request.

getParameter("upass");

ResultSetr=DB.executeQuery("select*fromloginwhereuname='
"+uname+ "'andupass=SHA1('" +upass+"')");

if(r!=null&&r.next()) {

if (r.getString("enabled") != null
&&r.getString("enabled").contentEquals("true"))
{

session.setAttribute("uname", uname);session.setAttribute("uid",

r.getString("uid"));session.setAttribute("utype",r.getString("utype"
DepartmentofComputerScience,CUSAT Page66
OnlineShoppingSystem
));

DepartmentofComputerScience,CUSAT Page67
OnlineShoppingSystem

if(r.getString("utype").contentEquals("admin"))

{response.sendRedirect("adminindex.jsp");

}elseif(r.getString("utype").contentEquals("mod"))

{response.sendRedirect("modindex.jsp");

}elseif(r.getString("utype").contentEquals("user"))

{response.sendRedirect("userindex.jsp");

}else{

session.setAttribute("uname", null);session.setAttribute("uid",

null);session.setAttribute("utype",null);response.sendRedirect("l

ogin.jsp?login=unknown");

}else{

response.sendRedirect("login.jsp?login=dissabled");

}else {

DepartmentofComputerScience,CUSAT Page68
OnlineShoppingSystem

response.sendRedirect("login.jsp?login=failed");

%>

 DATABASECONNECTION

packageDataBase;

importjava.sql.*;

publicclass DB {

static Connection con =

null;static Statement stmt =

null;staticResultSetrs =null;

publicstaticConnectiongetConnection(){try{

Class.forName("com.mysql.jdbc.Driver");

DepartmentofComputerScience,CUSAT Page69
OnlineShoppingSystem

con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/online_shoppi
ng","root", "root");

} catch (Exception e)

{System.out.println("Exception"+e);

returncon;

publicstaticbooleanexecuteUpdate(Stringquery)

{booleanf=false;

try{

con=getConnection();

stmt=con.createStatement();

intb=stmt.executeUpdate(query);if(b

> 0) {

f =true;

}else {

DepartmentofComputerScience,CUSAT Page70
OnlineShoppingSystem

f =false;

} catch (Exception e)

{System.out.println("Exception"+e);

returnf;

publicstaticResultSetexecuteQuery(Stringsql){try{

con=getConnection();

stmt=con.createStatement();rs =

stmt.executeQuery(sql);returnrs;

} catch (Exception e)

{System.out.println("Exception"+e);re

turnnull;

DepartmentofComputerScience,CUSAT Page71
OnlineShoppingSystem

publicstaticvoidclose()

{try{

con.close();

stmt.close();

rs.close();

} catch (Exception e)

{System.out.println("Exception"+e);

 ANDROID WEB-VIEW

ACTIVITYpackagecom.onlineshopping.act

ivity;

DepartmentofComputerScience,CUSAT Page72
OnlineShoppingSystem

importcom.onlineshopping.activity.R;

importcom.onlineshopping.activity.custom.CustomWebChromeClient;impor

tcom.onlineshopping.activity.custom.CustomWebViewClient;

importandroid.annotation.SuppressLint;imp

ortandroid.app.Activity;

importandroid.content.res.Configuration;im

portandroid.os.Bundle;

importandroid.view.KeyEvent;

importandroid.webkit.WebSettings.PluginState;imp

ortandroid.webkit.WebView;

@SuppressLint("SetJavaScriptEnabled")publicclas

sWebViewActivityextends Activity{

// the web view refence

objectprivateWebViewwebVie

w;

DepartmentofComputerScience,CUSAT Page73
OnlineShoppingSystem
//the siteurllink

DepartmentofComputerScience,CUSAT Page74
OnlineShoppingSystem

publicstaticfinalStringSITE_URL_START="http://";publicstati

c StringSITE_URL = "";

public static final String SITE_URL_END


=":8084/OnlineShoppingCart/";

@Override

protectedvoidonCreate(BundlesavedInstanceState)

{super.onCreate(savedInstanceState);setContentView(R.layout.activity_w

eb_view);

//gettherefernceof thewebview

webView=(WebView)findViewById(R.id.siteWebView);

// settheweb viewchromeclientand setforshowinga


progressbar

this.webView.setWebChromeClient(new
CustomWebChromeClient(this));

this.webView.setWebViewClient(newCustomWebViewClient(

DepartmentofComputerScience,CUSAT Page75
OnlineShoppingSystem

getApplicationContext()));

// on the ui thread do the

processingrunOnUiThread(newRunnab

le(){

@SuppressWarnings("deprecation")public

void run(){

//setthejavascripton

webView.getSettings().setJavaScriptEnabled(true);

//enablealltheplugins

webView.getSettings().setPluginState(PluginState.ON);

// load the

urlwebView.loadUrl(SITE_URL_START

+
SITE_URL+SITE_URL_END);

});

}
DepartmentofComputerScience,CUSAT Page76
OnlineShoppingSystem

//To handle"Back" keypress eventforWebViewtogo back toprevious

//

screen.@O

verride

publicbooleanonKeyDown(intkeyCode,KeyEventevent){

if((keyCode==KeyEvent.KEYCODE_BACK)&&we
bView.canGoBack()){

webView.goBack();r

eturntrue;

returnsuper.onKeyDown(keyCode,event);

//

flipscreennotloadingagain@Ov

erride

public void onConfigurationChanged(Configuration newConfig)

{super.onConfigurationChanged(newConfig);

}
DepartmentofComputerScience,CUSAT Page77
OnlineShoppingSystem

DepartmentofComputerScience,CUSAT Page78
OnlineShoppingSystem

CHAPTER4

CONCLUSION

TheprojectentitledOnlineshoppingsystemwascompletedsuccessfully.

The system has been developed with much care and free of errors and atthe same
time it is efficient and less time consuming. The purpose of thisproject was to
develop a web application and an android application forpurchasingitemsfroma
shop.

Thisprojecthelpedusingainingvaluableinformation and
practicalknowledgeonseveraltopicslike designing web pages using html &css,
usage of responsive templates, designing of android applications,
andmanagementofdatabaseusingmysql.Theentiresystemissecured.Alsothe project
helped us understanding about the development phasesof a project and software
development life cycle. We learned how to testdifferentfeatures of aproject.

Thisprojecthasgivenusgreatsatisfactioninhaving designed anapplication which can


be implemented to any nearby shops or brandedshopssellingvarious kindsof
productsbysimplemodifications.

Thereisascopeforfurtherdevelopmentinourprojecttoagreatextend.Anumberoffeatur
escanbeaddedtothissysteminfuturelikeproviding

DepartmentofComputerScience,CUSAT Page79
OnlineShoppingSystem

moderatormorecontroloverproductssothateachmoderatorcanmaintain their own


products. Another feature we wished to implement wasproviding classes for
customers so that different offers can be given toeach class.System may keep
track ofhistory ofpurchases of eachcustomer and provide suggestions based on
their history. These featurescouldhave implementedunless thetimedidnot
limitedus.

DepartmentofComputerScience,CUSAT Page80
OnlineShoppingSystem

REFERENCES

[1] JavaScript Enlightenment,Cody Lindley-First Edition, based


onJavaScript1.5, ECMA-262,Edition

[2] McGrawHill’s,Java:Thecompletereference7thEdition,Herbert
Schildit

[3] Complete CSS Guide ,MaxineSherrin and John Allsopp-


O'ReillyMedia;September2012

[4] http://www.w3schools.com/html/
defualt.asp,http://www.w3schools.com/css/
default.asp,http://www.w3schools.com/js/
default.asp

DepartmentofComputerScience,CUSAT Page81

You might also like