Anil Nembang-Computing Project Report Sample
Upcoming SlideShare
Loading in...5
×
 

Anil Nembang-Computing Project Report Sample

on

  • 4,459 views

Computing Project Report Sample by Anil Nembang

Computing Project Report Sample by Anil Nembang

Statistics

Views

Total Views
4,459
Views on SlideShare
4,459
Embed Views
0

Actions

Likes
1
Downloads
7
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Anil Nembang-Computing Project Report Sample Anil Nembang-Computing Project Report Sample Document Transcript

  • Anil Nembang [L0030BSBS0811] 1 Web-application for E-book Computing Project Report Author: Anil Nembang Lecturer: Mr. Nigel Kermode University: Cardiff Metropolitan University
  • Anil Nembang [L0030BSBS0811] 2 Contents Introduction:...........................................................................................................................................6 Background:............................................................................................................................................7 Abstract:..............................................................................................................................................7 Design Objective.................................................................................................................................7 Project Objective.................................................................................................................................7 Future Objective: ................................................................................................................................7 Goals of eBookBag.............................................................................................................................7 Project objective, outcomes, and outputs in general...........................................................................8 Project plan: ............................................................................................................................................9 Problem analysis:....................................................................................................................................9 Feasibility Study ...................................................................................................................................10 Organizational feasibility:.................................................................................................................10 Legal feasibility: ...............................................................................................................................10 Economic feasibility: ........................................................................................................................10 Technical feasibility:.........................................................................................................................10 Schedule feasibility:..........................................................................................................................10 Literature Review: ................................................................................................................................10 Growth of E-books and E-readers:....................................................................................................10 Current Online shopping behaviour:.................................................................................................12 E-book sales:.....................................................................................................................................12 Pros and cons of e-books: .................................................................................................................13 Digital Piracy and consequences: .....................................................................................................13 E-books and Piracy:..........................................................................................................................15 Solutions to the piracy problems:......................................................................................................16 Preface: .........................................................................................................................................16 Some important mechanisms to limit digital piracy (generic):.....................................................17 Limiting e-book piracy: ....................................................................................................................17 Changing social behaviour:...........................................................................................................17 Implementing Technical controls: ................................................................................................17 Enforcing Legal Rights of Content Owners:.................................................................................17 Conclusion: e-book piracy control:...............................................................................................18
  • Anil Nembang [L0030BSBS0811] 3 Online Transaction and security: ......................................................................................................18 Amazon.com:....................................................................................................................................18 Amazon Background: ...................................................................................................................18 How Amazon.com is controlling e-book piracy? .........................................................................19 How Amazon.com manages its inventory?...................................................................................19 What format does Amazon kindle uses?.......................................................................................20 Web based client/server Application: ...............................................................................................21 Abstract:........................................................................................................................................21 Web browser and Client side Scripting Languages: .....................................................................21 Web server and server side programming languages:...................................................................22 Hypertext Transfer Protocol: ........................................................................................................22 Web Application Technologies:........................................................................................................24 Types of Web applications:...........................................................................................................24 Languages used to build web application: ....................................................................................24 Analysis: ...............................................................................................................................................25 JSP vs. ASP (Active Server Page) ....................................................................................................25 JSP vs. PHP.......................................................................................................................................25 JSP vs. Servlets:................................................................................................................................25 JSP vs. Ruby: ....................................................................................................................................26 MySQL Database:.............................................................................................................................26 Conclusion: ...........................................................................................................................................26 Iterative and Incremental Development Model: ...................................................................................27 Increments:............................................................................................................................................28 Work Breakdown Structure: .................................................................................................................29 Design:..................................................................................................................................................30 Use Case Diagram: ...........................................................................................................................30 Class Diagram...................................................................................................................................31 Required Technologies: ........................................................................................................................32 Project legacy:.......................................................................................................................................33 Area of concern:................................................................................................................................33 Technical Lesson learned:.................................................................................................................33 Development:........................................................................................................................................33 Connecting MySQL Database to Eclipse IDE using java:................................................................33 Uploading files to MySQL Database:...............................................................................................34
  • Anil Nembang [L0030BSBS0811] 4 Creating MySQL database table:..................................................................................................34 HelloServlet: .................................................................................................................................36 Upload Binary Files Using BLOB:...............................................................................................37 Problem in coding Upload servlet:................................................................................................37 Class com.o'reilly.servlet.multipart.MultipartParser: ...................................................................38 E-book Shopping Module:................................................................................................................39 Creating the Login.html Page: ......................................................................................................39 Creating Sign Up Page:.................................................................................................................40 InvalidUser.html: ..........................................................................................................................41 Validate .jsp Page: ........................................................................................................................42 Search Criteria Page:.....................................................................................................................43 Search Page:..................................................................................................................................44 New Search Page: .........................................................................................................................45 Purchase Page: ..............................................................................................................................46 Logout page: .................................................................................................................................47 Administrative Module:....................................................................................................................48 Admin Page:..................................................................................................................................48 InsertBook Page............................................................................................................................49 Modify Page:.................................................................................................................................50 Gantt Chart:...........................................................................................................................................51 Conclusion:............................................................................................................................................52 Appendix ...............................................................................................................................................56 Figures: Figure 1: E-reader growth.....................................................................................................................11 Figure 2: e-Reader Price Decreases by Manufacturer...........................................................................11 Figure 3: e-book sales trend..................................................................................................................12 Figure 4: Facts about online piracy.......................................................................................................14 Figure 5: Consequence of piracy ..........................................................................................................15 Figure 6: Most pirated e-books on web (Supporting Link) (another supporting link) .........................16 Figure 7: Drop-shipment model............................................................................................................19 Figure 8: Customer fulfilment network of Amazon..............................................................................20 Figure 9: Statistics of client side programming ....................................................................................21 Figure 10: Statistics of server-side programming language..................................................................22 Figure 11: Communication steps between web browser and web server .............................................23 Figure 12: Three-tier architecture .........................................................................................................23
  • Anil Nembang [L0030BSBS0811] 5 Figure 13: Iterative and incremental development model available .....................................................27 Figure 14: Work Breakdown Structure.................................................................................................29 Figure 15: Use Case Diagram...............................................................................................................30 Figure 16: Class Diagram .....................................................................................................................31 Figure 17: Database and java connection .............................................................................................33 Figure 18: MySQL Database (Demo)...................................................................................................34 Figure 19:Upload Interface (Code available here)................................................................................35 Figure 20: Hello Servlet (Code available here).....................................................................................36 Figure 21: Error in Uploading Binary Files..........................................................................................37 Figure 22: Successfully uploaded Portable Digital Format (Code available here)...............................38 Figure 23: Login Page (Code Available here) ......................................................................................39 Figure 24: Sign Up Form (Code available here)...................................................................................40 Figure 25: InvalidUser..........................................................................................................................41 Figure 26: Validate.jsp..........................................................................................................................42 Figure 27: Search Criteria Page (Code available here).........................................................................43 Figure 28: Search Page (Code available here)......................................................................................44 Figure 29: New Search Page (Code available here)..............................................................................45 Figure 30: Purchase page (Code available here)...................................................................................46 Figure 31: Logout Page (Code available here) .....................................................................................47 Figure 32: Administrator Page (Code available here)...........................................................................48 Figure 33: Insert Book Page (Code available here) ..............................................................................49 Figure 34: Modify Page ........................................................................................................................50 Figure 35: Gantt Chart ..........................................................................................................................51
  • Anil Nembang [L0030BSBS0811] 6 Introduction: An electronic book (also known as e-book, digital book or e-edition book) is a book published in in digital form and readable on computers or other electronic devices. E-books are usually readable on e- book readers, tablets, computers and smart phones. The usage of e-book has increasing trend in the digital era. There are many dedicated technologies like Amazon’s Kindle, Sony Reader, Pocketbook, and Kobo for e-book. The aim of this project is to dispatch published book throughout the world through internet. Different published books will be displayed in www.eBookBag.com for selling purpose. It is aimed that eBookBag.com will be developed as electronic library collecting and storing more and more books. Therefore this undertaking is not only business oriented but it also helps to develop, boost, and prosper Nepalese literature. The domain of Nepalese literature is expanding because of rising trend of use of social networking sites and also Nepalese Diaspora throughout the world. In this scenario, the motive is to distribute Nepalese literature in every corner of world and to enhance popular e-book reading culture. This project has been initiated intending to publish and deliver electronic books to millions of Nepalese who are living abroad. It has been experienced that it is very burdensome and expensive to access books in abroad. In this situation e-book is the most effective modern alternative. It is unrealistic to anticipate the number of e-readers in Nepal but undoubtedly e-book has shining market in future because of gradual introduction of modern technologies in Nepal. It has also been symbolized by increasing e-reading trend in world. It is not unusual to worry about piracy because of digitization of paper books. But this project employs its effort to mitigate the intellectual property right infringement. The technology called Digital Rights Management ensures piracy as it doesn’t allow printing and downloading and transferring from one device to another.
  • Anil Nembang [L0030BSBS0811] 7 At last, eBookBag.com will always be dedicated and remains active for easy access of Nepalese literature throughout the world. Background: Abstract: Technological advancement has revolutionised the shopping behaviour of customer, and is called online shopping. A customer can search the products, view the products, compare the quality of products, compare the price, purchase the product, take delivery of an electronic product and post the feedback online. The important aspect of online shopping is, it is 24/7 and has no geographical boundaries. However, online shopping has certain limitations which are the major barriers for some customers. The obvious needs for e-shopping are computer equipment, internet broadband connection and to some extent, the skill to use online tools. Moreover, the transaction security is also major concern for potential customers. The web application for E-books (eBookBag) allows customers to search a specific book in an online database and purchase it. The application also allows administrator to manage books stored in database, such as adding books, adding, modifying and updating books’ category and information. Design Objective The design objective of the project was to create online bookstore. The system provides mechanism for searching the available book title database with various categories. The system allows users to purchase e-books online. The Tomcat was used as application server. Project Objective The main objective of this project was to develop eBookBag as primary portal for Nepalese Diaspora to buy digital books. To achieve this main objective, the project best utilized the technologies. The eBoookBag is:  Easy-to-use in terms of interfaces. The customers are able to purchase e-book in fewer clicks possible.  Efficient, in terms of quality of the search result, the response time, and the navigation performance.  Secure, to ensure full privacy and anonymity. Future Objective: The project will be upgraded for online order of books within the territory of Nepal. The site will also be upgraded as online E-library and other E-activities like combine literature writing. Goals of eBookBag The eBookBag will strive to achieve the following goals:  Become a successful e-book vendor in Nepalese domain.  Attract 200 registered users in first year.  Achieve 200 visits per months.
  • Anil Nembang [L0030BSBS0811] 8 Project objective, outcomes, and outputs in general Nepalese diaspora are not able access Nepalese literature Develop online shopping portal to buy digitized Nepalese literature lililiterature People purchase e-books irrespective of time and geography 1) Make books available online 2) Easy-to-use and user- friendly interfaces 3) Efficient navigation, search results and response time 4) Secure transactions Problem Analysis General Objective Specific Outcome (concrete results necessary for producing solutions) Outputs (actions to achieve outcome)
  • Anil Nembang [L0030BSBS0811] 9 Project plan:  The website starts with displaying home page where customers can see the e-books of different categories and sub-categories.  The login screen displays where customers are allowed to enter valid user name and password. If user name and password are invalid then, customers are prompted to inter correct user name and password.  The signup field displays for unregistered customers where customers have to fill the signup form. The fields with star sign are compulsory.  There is also a login form for administrator where administrator has to input valid user name and password. If username and password are not correct then the administrator is prompted to put valid one. Problem analysis: The web application for e-books has actor called customer. The buyers log in with unique user name and password, search, find, compare, and evaluate the e-book and finally purchase the e-book. The administrator logs in to the site and adds, deletes, modifies, and manages the database. Thus the problem in online shopping of e-book normally applies in these two users. The problems are listed below:  Secure transaction- security should be top priority for every online entrepreneur with e- commerce ambition. Giving shopper confidence that their credit/master/debit card details are safe in entrepreneur’s hand can make them more apt to make purchase. Conversely, their deep seated worries about fraud make them back out of online purchase and seek for other safe options (Riva, 2012).  Huge sales and purchase record: The administrator needs to handle huge sales and purchase record. An up-to-date database is useful resources in planning new marketing and sales strategies. It also helps to manage account, interest, taxes, and working cost effectively. Moreover, up-to-date data is important to evaluate customer service and employee efficiency.  Data redundancy problem: Only accurate data helps to make right decision. Redundant data misleads and can cause failure in entrepreneurship.  Interface: All the potential buyers can’t be technical. So, easy-to-use and user-friendly interfaces in web application play crucial role in successful business. The project has aimed to provide secure, reliable, and easy transaction in fewer clicks to support non-technical buyers.  Piracy: Mike Masnick says “you can’t compete for free.” Piracy is triggering many problems in digital world. Digital piracy can cause huge loss in profit and also cause loss in jobs. So, digital piracy can be controlled to some extent by implementing some policies(Arun, 2004).
  • Anil Nembang [L0030BSBS0811] 10 Feasibility Study Organizational feasibility: From organizational perspective, the project had low risk. Organization had sufficient management expertise, organizational competence and resources to successfully launch the project. Legal feasibility: The project team has had consulted with legal advisor. The eBookBag was registered under Company Registration Act 1947 and was subjected to cyber law of land in case of breaching the law. Data of customers and all other stakeholders thus collected should be used legally abiding by Data Protection Act. Enquire had been conducted at Office of Copyright, Nepal to secure Intellectual Property Right of Authors. Economic feasibility: It is very hard to go to book stores and get book due to frequent political strike. On the other hand, people are draining abroad because of fragile political situation in Nepal. And there is an increasing trend of abroad study. This initiation of digitization is likely to address the problem as customer can buy digitized book from anywhere and at any time online. The reading behaviour of Nepalese is increasing these days. The result of research conducted by Readers Club Nepal revealed that the no. of literature reader in Nepal has increased by 70 per cent in the past one decade. Technical feasibility: The project size was considered low risk. Most of the technical tools were open sourced. Schedule feasibility: The project needed to be finished within 19th of July. Literature Review: Growth of E-books and E-readers: The market for e-books and e-readers has seen tremendous in the last two to three years. “I-supply” reported last year in December that shipments of e-book readers in 2011 were up 108 per cent from 2010. The sales of e-books in UK rose to 11 per cent of total consumer book sales in 2011 and to 15 per cent in 2012 according to a report by Enders Analysis (Sean, 2012).
  • Anil Nembang [L0030BSBS0811] 11 Figure 1: E-reader growth In the 4th quarter of 2011, Amazon offered a cheaper version of the Kindle for 99 € in Germany, France and Italy and for £89 in the UK. This remained their cheapest e-reader device until the 3rd quarter of 2012, when the 2012 version of the Kindle was released for 79€ in Germany, France and Italy and for £69 in the UK.(Travis, 2012) Figure 2: e-Reader Price Decreases by Manufacturer
  • Anil Nembang [L0030BSBS0811] 12 Current Online shopping behaviour: Shops suffered their third worst sales month of 2012 in December because of a record rise in online trading. Retailers saw sales increase by 1.5 per cent last month, compared with December 2011, although online buys went up 18 per cent in the Christmas rush. “In the most critical month of the year, consumers used online retail more than ever”, said British Retail Consortium director general Helen Dickinson (James, 2013). E-book sales: Consumer e-book sales in the UK increased by 366% last year helping to offset a decline in the market of printed books, according to new official record. The publishers Association drew the information provided by 250 publishers and concluded the value of consumers’ e-book sales – fiction, non-fiction and children digital titles-at £92 million in year 2011. This is 366% increase on the previous year. The publishers Association said. (Flood, 2012) E-book sales trend: Figure 3: e-book sales trend
  • Anil Nembang [L0030BSBS0811] 13 Pros and cons of e-books: Pros: The e-books provides following obvious advantages:  Available online.  They are easily readable because of font resizing, zoom functions and so forth.  They are portable and can be carried multiple books in a single e-reader device.  E-books are environmental friendly as trees are not killed like paper books.  Making notes and referencing it is very powerful in e-books. Notes and references need not to be permanent.  Lighting condition is meaningless. We can read e-books irrespective of darkness or lightness. Cons: The cons of e-books usually arise from hardware used.  Battery doesn’t last for long.  Bugs in the reader cause it to freeze up.  E-readers are not robust. Liquid potentially damage the readers.(http://coeus.hubpages.com, 2012) Digital Piracy and consequences: The term ‘piracy’ refers to illegal copying and distributing of proprietary contents such as software, music, video, e-books etc. (Dana et al, 2006). It is the theft of intellectual property. The digital revolution has brought about many changes in our lives. However, digital piracy is continuous problem and is affecting negatively the industries. Online piracy is a real life crime and is triggering serious consequences. Paul Tassi, author of www.forebs.com argues that ‘As technology continues to evolve, the battle between pirates and copyright holders is going to escalates, and pirates are always, always going to be one step ahead. You will never kill piracy.’ Tassi P. (02/03/2012). Digital piracy includes the purchase of counterfeit product on discount to the price of copyrighted product, and illegal file sharing of copyrighted material over network. The International Federation of phonographic Industry (IFPI) claims that 34% of all recorded music sold were pirated copies and cost over $4.6 billion per annum. It further claimed that business software worth $32 billion was pirated in 2005. Moreover, Charles (2007) stated that the publishing industries are also worried about digitization of printed media, when coupled with development of e-readers, may be accompanied by digitized texts.(Hill, 2007) Hill W.L. C. (30/01/2007) further argued that the scope of piracy gets larger in next decades because of rapid diffusion of broadband connection into internet which makes easier to download digital items online. As anticipated by Charles, the digital piracy rate is escalating at the moment.
  • Anil Nembang [L0030BSBS0811] 14 As a leading global producer of digital content, the impact of digital piracy is substantial in the US, with the US companies losing billions of dollars annually and eliminating and never creating tens and thousands of jobs. Although piracy is serious problem in United States, it is even more serious problem in other parts of world especially emerging market. The business Software Alliance found that although software piracy is declined, global piracy has been increased by 3 per cent in 2008 because of rapidly expanding growth of PC ownership in high piracy region like Asia and Eastern Europe. (Castro, 2009) Facts about online piracy (Info graphic): Figure 4: Facts about online piracy
  • Anil Nembang [L0030BSBS0811] 15 Info graph of consequence of online piracy (Info graphic): Figure 5: Consequence of piracy E-books and Piracy: E-book piracy has been growing in alarming rate and is causing serious threat to publishing industry. The survey conducted with 1,900 consumers by Digital Entertainment revealed that one in eight who own e-reader admitted to downloading illegal copies of e-books. Twenty-nine per cent of all e-readers surveyed admitted to piracy. In the U.S. it is estimated that e-book piracy costs the industry $3 billion dollars. (Shawn, 2011)
  • Anil Nembang [L0030BSBS0811] 16 Most Pirated e-books on web (Info graphic): Figure 6: Most pirated e-books on web (Supporting Link) (another supporting link) Solutions to the piracy problems: Preface: The rise of broadband internet and cheaper storage has flourished the digital piracy. It requires tremendous effort to control the digital piracy. Digital piracy cannot be killed or permanently stamped out but it can be controlled and reduced dramatically. Castro D. (December 2009) states that there is no “silver bullet” to solve the piracy problem-no single technical or legislative proposal solves such a complex issue-but there are many “lead bullets” that can help reduce piracy. Just as preventing theft in offline world requires a combination of industry backed technical controls such as locks, closed- circuit TV, and anti-theft packaging as well as government funded system of law enforcement; digital piracy requires a coordinated approach. (Castro, 2009) Many of the control or limiting mechanism comes from industry; but government should also play key role in implementing strong legal system in the bedrock of digital world as in the analogue world.
  • Anil Nembang [L0030BSBS0811] 17 Some important mechanisms to limit digital piracy (generic):  Support, rather than impede, anti-piracy innovation, including the development of new technical means.  Encourage coordinated industry action to take steps to fight digital piracy, including steps like ISP implementation of graduated response systems.  More actively pursue international frameworks and action to protect intellectual property of copyright of digital contents. Limiting e-book piracy: In this digital era, e-book piracy is growing in higher pace threatening the publishing industry. Copyright infringement is causing huge loss to publishing industry. E-book piracy cannot be beaten out permanently but there are certain measures to control and limit to some extent. Changing social behaviour: Content producers have been working to change social behaviour of users because digital piracy exists, in large part, as people choose to engage in it. Digital piracy can be discouraged by simply educating them about digital piracy and its impact or providing them easier means to access digital contents legally. Some of the non-technical measures are:  Educate users on impact of digital piracy.  Provide easier legal means to access the content. Implementing Technical controls: Various technical controls can help reduce digital piracy. These controls can be implemented in one or more of the processes used to exchange and view copyrighted contents-from the users’ device to Internet Service Provider used to transfer the content. Some of the technical controls are:  Digital Right Management: This system prohibits transferring, downloading copyrighted content from one device to another device. It also doesn’t allow printing the contents.  Network Management: Applying bit cap mechanism.  Content Identification System: This system enables owner to detect copyrighted content if other try to share it.  Blocking internet users from website that index or search pirated contents.  Blocking internet users from website that provides pirated contents. Enforcing Legal Rights of Content Owners: Content producers can also apply legal means to protect their interest by pursuing criminal and civil penalties against individuals and organizations who are engaged in or enabling digital piracy. Publishers and experts at Frankfurt Book fair argue “If you give normal, regular, upstanding citizens a legitimate route to your material they are more likely to attain it legitimately, most people do not want to steal.”(Reporter, 2011) Some of the legal means are enlisted below:  Lawsuits against individuals or organization facilitating pirated digital contents.  Lawsuits against internet users engaging in pirated digital contents.  Notice and response to copyright infringement (Castro, 2009).
  • Anil Nembang [L0030BSBS0811] 18 Conclusion: e-book piracy control: Publishers and expert at Frankfurt Book Fair in Germany claims that e-book theft is unlikely to go away but it is manageable up to large extent. According to Mollet a publisher expert, people will always try to get the pirated eBook content either because they believe it should be free, simply because they can, or because they do not want to corporate account or are underage. On the other hand he also argues “All these factors mean infringement will be present in our market, but it is likely to remain a manageable proportion, more precisely 80 to 90 per cent”(Reporter, 2011). Some Instructions: Place a watermark on e-book. A watermark is a digital, transparent stamp that shows an item to be proprietary. Use logo or publishing name. Watermarks can be created by photo editing software such as Photoshop and word processing software such as Microsoft Word. Sell non-editable e-books in read-only format. Convert books to PDF or printable document files with a read-only limitation. When converting e-books from word processing documents to printable document files or PDFs; select a read-only option. Use an anti-piracy program. Use software that protects e-book from piracy such as Virtual Vault, PiracySniper or eBook Pro. These programs not only help reduce or eliminate piracy; they prevent printing, so copies cannot be printed and disseminated. Install an encryption key or password using encryption or password generating software. Programs developed by companies such as Ants soft and Lexicology generate passwords to prevent e-book piracy (Richason, 2013). Online Transaction and security: Every day, millions of pounds change hands across the internet in online transaction. Consumers should feel secure every time they pay online. Criminal needs only three pieces of personal information to steal someone’s digital identity to commit fraud, security service firm Verisign has warned. The UK Serious Organized Crime Agency (SOCA) estimates online fraud is costing UK internet users around £ 3.5 billion per year. According to the result of research by Verisign, about 11% of UK’s online community has been a victim of fraud in the past year (Ashford, 2010). There are many security protocols are widely used at online commerce site. Secure Socket Layer (SSL) automatically encrypts credit card number and other private and important information that are sent over internet. Another security protocol that works on different principles is ‘Secure Electronic Transaction’ (SET). PayPal hosts individual pages for participating online merchants that are equipped with PayPal’s own security protocols. According to PayPal they provide ‘the most secure online Transaction’ (Chesnut, 2012). Amazon.com: Amazon Background: Amazon.com is one of the first online shopping sites, consistently ranked as number one retail site launched in 1995. According to an analyst, “When you think of web shopping; you think of Amazon
  • Anil Nembang [L0030BSBS0811] 19 first.” It first started its business with books but later expanded with varieties products like music CDs, DVDs, apparel, software, home appliances and many more. The main features of Amazon.com are one click shopping, customer review and e-mail order verifications. It is the coalition with other retailers and provides wide category of new products. (Jha et al, 2010) How Amazon.com is controlling e-book piracy? The online retail giant Amazon.com is considering some piracy-prevention measures. Engleman E. (30/10/2009) says that Amazon.com recently patented a method for “programmatically substituting synonyms into distributed text content” so that “illicit copies of the excerpt may be recognized.”(Engleman, 2009) How Amazon.com manages its inventory? Jeff Bezos, CEO, Amazon.com says “In physical world it’s the old saw: location, location, location. The three most important things for us are technology, technology, technology.” Jeff Bezos, in 1995 started Amazon.com as a virtual retailer; no inventory, no warehouse; just computers. Later he built six computerized warehouses each costing $50 million. To make inventory management easier, he applied automated event system after placing order. Inventory management strategy:  Inventory goals- right product in the right quantity to the right place at the right time.  Reduce redundant inventory.  Low inventory turnover.  Inventory outsourcing (because cost of holding is higher than cost of outsourcing). Drop-shipment model of Amazon: Figure 7: Drop-shipment model
  • Anil Nembang [L0030BSBS0811] 20 Amazon’s customer fulfilment network: Figure 8: Customer fulfilment network of Amazon What format does Amazon kindle uses? Many different e-book readers are available in market and each has its own pros and cons. E-book files also have various formats. There is no single e-book reader which can support all the formats. The kindle supports large number of existing format either natively or by conversion. Kindle requires special software to make few file formats compatible with the kindle. (Southern, 2012) AZW: The primary format: AZW is the format that is used to read the e-book files bought in Amazon Kindle’s store. AZW is preferred as it ensures maximum readability of the files. It is the proprietary format initially developed by French company Mobipocket. Amazon owned Mobipocket and adopted to use it in Kindle. Other native formats: The kindle also displays other formats natively. MOBI and PRC format files can be directly loaded in the kindle and can be displayed as primary AZW format; but Digital Right Management (DRM) should not have been applied to those files. DRM limits the file to single device. Moreover, Amazon Kindle also handles other formats like plaint text TXT format and PDF format, although not all Adobe PDFs displays well in the kindle. (Southern, 2012) Formats available through conversion:
  • Anil Nembang [L0030BSBS0811] 21 Conversion typically involves sending files to Amazon Kindle email address. Amazon says it can convert HTML and DOC files as well as graphic files like PNG, JPEG, and GIF etc. Unsupported format: The kindle cannot support the formats like EPUB (open source format), LIT (use by MS Reader), and LRF (Sony format). However, open source programs like Calibre can be used to convert aforementioned format to the format compatible to the kindle. Web based client/server Application: Abstract: Web based client/server application follows three-tier architecture. The application is divided into three parts. Client side code runs in web browser, server side code runs in web server and database are managed in database server. (Arora, 2011) Web browser and Client side Scripting Languages: Web browser is the client side software or application used to request the web pages. Web browser not only requests the web pages, it also acts the interpreter. It interprets the HIML code and displays in the browser. It also interprets client side code if embedded in web page. Some of the validations are applied also in client side. If requirements are not valid in client side then the web browser does not submit that web Pageto web server and save request-response time. Some of the client side scripting languages are JavaScript, Python, Ruby, Perl, etc. Internet explorer, Mozilla Firefox, Opera, Safari, Google Chrome are the main commercial web browsers.(Arora, 2011) Statistics of client side programming languages for websites: Figure 9: Statistics of client side programming
  • Anil Nembang [L0030BSBS0811] 22 Web server and server side programming languages: Web server is the special type of software that is used to post the web pages. It also interprets, compiles and executes server side codes if embedded in the requested web pages. Server side code contains logical decisions, evaluations, and performs calculations, accesses database and manipulate data. Common server side coding languages are Java, PHP, ASP.NET, ColdFusion, Ruby, Python etc. Microsoft’s IIS, Abyss, Jigsaw etc. are some of the examples of web servers. Statistics of server side programming languages for websites: Figure 10: Statistics of server-side programming language Hypertext Transfer Protocol: The communication protocol at application layer between web browser and web server is HTTP protocol. To establish connection between client and server, HTTP uses port 80. HTTP protocol is stateless protocol and the state between web browser and web server is maintained by server side code using in-built classes. HTTP uses GET method and POST method to request and response web pages.
  • Anil Nembang [L0030BSBS0811] 23 How web browser and web server communicates? Figure 11: Communication steps between web browser and web server Three tier architecture: Figure 12: Three-tier architecture
  • Anil Nembang [L0030BSBS0811] 24 Web Application Technologies: Most modern business is web enabled to in effectiveness, efficiency, and productivity etc. Types of Web applications: Mainly, there are three types of client server applications:  Customer-facing applications: Customer-facing application is also known as B2C (Business-to-Consumer) sites or E-commerce and uses internet. This type of web application allows customer to buy varieties of products and services using shopping cart and payment method. For example http://www.amazon.com and http://www.ebay.com are the two giant e- commerce web applications prevailing in web industry. The Economist (March, 2004) estimates that 200 million Americans will buy about $120 Billion of goods of goods and services over the internet using B2C web application on 2004, obviously $600 per person(Vermeulen, 2004).  Employee-facing applications: Employee-Facing applications are those which are used by internal employees of an organization for effectively and efficiently manage and conduct the organizational activities.  Customer-Supplier facing application: Customer –Supplier facing application is also known as B2B (Business-to-Business) web application and uses extranet (an extension of intranet that allows outside companies to work in a password-protected space). B2B site provide secure means of exchanging information. An example is supplier chain software which allows all suppliers to see demand and inventory in supply chain (Vermeulen, 2004). Note: These categories do not fit all other applications. For example Yahoo! Mail which doesn’t fall under any category above. However, these three categories are the representative of type of web applications. Languages used to build web application: Originally, internet was designed to serve static pages. A rudimentary technology called CGI (Common Gateway Interface) to pass information to web server. But nowadays CGI has been refined and other competing technologies have emerged. Some of the competing technologies used to develop web based applications are CGI (Common Gateway Interface), ColdFusion, LAMP (Linux, Apache, MySQL, PHP), Java/JEE, and Microsoft .NET.  CGI: Common Gateway Interface is the granddaddy interface for passing data from a submitted webpage to a web server. To be straightforward, CGI is the connection/ interface between a form on a web page and the web server.(Jennifer, 2011)  ColdFusion: A ColdFusion application very simply is a collection of pages, similar to static website. But unlike in the static website, the pages in a ColdFusion application include the server-side ColdFusion Mark-up Languages (CFML) in addition to HTML. CFML gives the ability to control the behaviour of applications, integrate a wide range of server technologies, and dynamically generate the content that is returned to the web browser. ColdFusion pages consists of standard HTML tags such as <FONT SIZE = +2>, together with CFML tags such as <CFQUERY>, <CFIF>, and <CFLOOP>. (Michael, 2012)  LAMP/WAMP/XAMPP: These are relatively newer technology stacks for building web based application. These technologies rely on CGI to exchange data between web client and web server but CGI are hidden from the developers.
  • Anil Nembang [L0030BSBS0811] 25  Microsoft.NET. Technology: Microsoft is using .NET technology for server market. The stacks used in this technology comprise of web server (ASP.NET) and two programming languages VisualBasic.NET and C#.NET. This technology also have database server called SQL server. (Bert, 2004)  Java/J2EE Technology: Java is a robust, well-developed method for creating medium to large web applications. Sun Microsystem developed J2EE to make the application development easy in thin client environment. J2EE decreases the need for programming by creating standardized and reusable modular components and enabling tier technology. J2EE (Java 2 Platform Enterprise Edition) consists of following components, - The Java Development Kit - Common Object Request Broker (CORBA), a predecessor of Enterprise Java Beans (EJB) so that java objects can communicate with CORBA Objects locally or remotely. - Java Database Connectivity (JDBC) equivalent to Open Database Connectivity (ODBC) - Security Model to secure data locally and form web applications. - Support for Enterprise Java Beans (EJB) which supports Extensible Mark-up language. - The java servlet Application Interface. - Java Server Page (JSP) used for dynamic web-enabled data access and manipulation. Analysis: JSP vs. ASP (Active Server Page) Microsoft’s Active Server page allows developers to use simple scripting to access the server and extensions. ASP gives the efficient way to return dynamic content but it essentially limits the platform to Microsoft. JSP has advantages in two folds. One is the dynamic part of web is coded in java; it’s more powerful and robust. Second, JSP is platform independent. JSP can be run in any operating system and web servers. JSP vs. PHP PHP is much appreciated because of flexibility and compatibility with most database platforms and operating system. However, PHP is less scalable and robust in comparison to JSP. As mentioned above, as dynamic contents in JSP are written java, it is more scalable and robust JSP vs. Servlets: JSP cannot provide its capabilities without the principle of servlets. JSP are translated into servlets behind the scene before it is executed. However, it’s more convenient in JSP to write and modify HTML than to have many print line statement to generate HTML in servlet. Moreover, presentation layer can be separated from business logic in JSP.
  • Anil Nembang [L0030BSBS0811] 26 JSP vs. Ruby: Ruby is scripting language which can be interpreted on the fly whereas JSP are first compiled and then executed. Ruby code is typically shorter than its java counterparts. But java has clear edge in terms of robustness and performance as well as more established technology. On the top of that JSP uses static typing (variables can be declared and initialized anywhere before the use of variables) which brings flexibility to developers while Ruby uses dynamic typing (need to declare variables before they are used). MySQL Database: MySQL is characterised as open source relational database server. MySQL lacks some sophistications like oracle however the active development team are adding more capabilities. MySQL database can be good choice for lightweight applications. MySQL works in client/server or embedded system. Conclusion: All above languages have their own pros and cons. The project www.eBookBag.com wants to add other online features like online activities, online ordering (domestic), online library, and combined online literature writing in near future. The scope of www.eBookBag.com can be expanded from Nepalese literary domain to international domain. Thus www.eBookBag needs to have robust foundation to handle the expected large number of users in future. Therefore the project used JSP (Java Server Page) because of following characteristics,  Robustness in terms of heavy data and media processing  Can handle potential concurrent usage by many users.  Scalable  Portable in terms of platforms like operating system and web application servers.  Write once run anywhere advantage. The project used MySQL database server because of following characteristics,  Many GUI management tools.  Speed is emphasized over lesser used features  Use little overhead.  Good community support. The project used Iterative and Incremental model because of following characteristics,  A functional product is available at the end of every iteration  Easier to test and debug during small iteration.  Easier to manage risks because risky pieces are identified and handled during its iteration.  Ability to change requirements throughout the project lifecycle.
  • Anil Nembang [L0030BSBS0811] 27 Iterative and Incremental Development Model: Iterative and incremental development model is a method of software development that is modelled around a gradual increase in future additions and cyclic release and upgrade pattern. Figure 13: Iterative and incremental development model available Activities involved in Iterative and Incremental Development Model:  Start with very small version of a program like user interface. Test it to make sure it runs.  Analysis: Decide which improvement should be made next. Make a small change.  Design how to code the changes.  Code it and compile to make sure that the coding is correct.  Testing: Run the program using test data. If it doesn’t run, program must be debugged and either the design or the coding must be changed. As the last change is small, it is easy to find the source of problem.  Continue around the loop until the program of resources (time) is finished. Iterative approach means that there is a running program at the end of iteration.
  • Anil Nembang [L0030BSBS0811] 28 Increments: Increment 1: Log in Page Increment 2: Sign Up Form Increment 3: Search Criteria Page Increment 4: Search Page Increment 5: New Search Page Increment 6: Purchase Page Increment 7: Download Servlet Increment 8: Logout Page Increment 9: Admin Page Increment 10: Insert Book Page Increment 11: Upload Servlet Increment 12: Modify Book Page Activities, time taken by each iteration and their status is depicted in Gantt chart (available here)
  • Anil Nembang [L0030BSBS0811] 29 Work Breakdown Structure: Figure 14: Work Breakdown Structure
  • Anil Nembang [L0030BSBS0811] 30 Design: Use Case Diagram: Use case diagram projects actor associated with the end product and the activities related to each actor. In this Use Case Diagram, actor is the customer and customer can browse, view, purchase, get, electronic delivery and give feedback. Figure 15: Use Case Diagram
  • Anil Nembang [L0030BSBS0811] 31 Class Diagram The parent class and the child class and their relationships are shown below. Figure 16: Class Diagram
  • Anil Nembang [L0030BSBS0811] 32 Required Technologies: Eclipse Juno Version: The project uses Eclipse as Integrated Development Environment. Eclipse is preferred by the project because of the following reasons:  Supports multiple languages and toolkits  Has many plug-ins  Can integrate with application servers.  Open source Java Development Kit: Java Development Toolkit is a set of development tools used in the programming of java applications and to uses libraries written in java. The Eclipse IDE requires JDK installed locally. JDK also includes other tools like JRE (Java Runtime Environment) to run application written in Java and Java compiler Javac to compile java before running in Java Virtual Machine. Tomcat: Tomcat is open source web server and web container deployed by Apache Software Foundation (ASF) that allows implementing Java Servlets and Java Server Page web application. Java Server Page: Java Server Page is the server-side programming technology that enables the creation of dynamic, platform independent method for building web-based application. Features of Java Server Pages:  Good performance because JSP allows to embedded dynamic elements in HTML pages.  JSP can be used in combination with Java Servlets.  Java Server pages are built on top of Java Servlets API. So, it has access to Enterprise Java APIs including JDBC, JNDI, EJB, JAXP etc.  JSP is integral part of J2EE, a complete platform for enterprise class applications. JavaScript: JavaScript is a client-side scripting language which can be inserted in HTML pages used to make web pages dynamic and interactive. JavaScript is supported by most of the modern web browsers including Internet Explorer, Chrome, Firefox, Safari etc. Extensible Mark-up Language (XML): XML is Mark-up Language that defines set of rules for encoding documents. XML is used to store and transport electronic document is standard format. MySQL Database Server: MySQL is an open source relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases.
  • Anil Nembang [L0030BSBS0811] 33 Project legacy: Area of concern: The remaining concern of this project is to add shopping cart module so that customers within Nepal can place order online at any time. Technical Lesson learned: We should use Open Project tool to effectively and efficiently manage the activities, resources and time. Development: Connecting MySQL Database to Eclipse IDE using java: First MySQL community server 5.1 is installed in computer. Then the database called Ebook is created. Finally database Ebook is connected to Eclipse with the help of MySQL connector. Figure 17: Database and java connection
  • Anil Nembang [L0030BSBS0811] 34 Uploading files to MySQL Database: Creating MySQL database table: Create database Ebook; Use Ebook; Create table Information(Name varchar(45), Author varchar(45), ISBN int, Price double; File mediumblob); The above script created database called Ebook and a table called Information. File is stored in 'File' column which is of type Mediumblob and can store file size of 16 MB. Figure 18: MySQL Database (Demo)
  • Anil Nembang [L0030BSBS0811] 35 Figure 19: Upload Interface (Code available here)
  • Anil Nembang [L0030BSBS0811] 36 HelloServlet: Hello Servlet was developed to test whether the IDE supports simple servlet or not. This Servlet displays "Helo From Anil". Figure 20: Hello Servlet (Code available here)
  • Anil Nembang [L0030BSBS0811] 37 Upload Binary Files Using BLOB: In this Project, Binary files were uploaded using Binary Large Object (BLOB). A BLOB is a data type that can store binary data. This is different than most other data types used in databases, such as integers, floating point numbers, characters and strings, which stores letters and numbers. Since BLOBs can store binary data, they can used to store images, multimedia files and files other extensions. (TechTerms.com) Problem in coding Upload servlet: Figure 21: Error in Uploading Binary Files This problem was solved by importing jar file of MySQL driver in WebContent folder of the project E-BookBag.
  • Anil Nembang [L0030BSBS0811] 38 Figure 22: Successfully uploaded Portable Digital Format (Code available here) Class com.o'reilly.servlet.multipart.MultipartParser: In this project, COS library was used to upload the binary files. It is a utility class to handle multipart/form-data requests that supports file uploads. This class use a pull model where the reading of incoming files and parameters is controlled by the client code, which allows incoming files to be stored into OutputStream. This class receive arbitrarily large files fairly efficiently.
  • Anil Nembang [L0030BSBS0811] 39 E-book Shopping Module: The E-book shopping module consists of HTML and JSP pages that enables an end user to login and logout as registered user and to purchase and search for a book from the online database. Creating the Login.html Page: The Login.html page enables the end user to enter the user name and password. It also contains a hyperlink for registering the new users. The login.html page is the first page of E-BookBag project. Figure 23: Login Page (Code Available here)
  • Anil Nembang [L0030BSBS0811] 40 Creating Sign Up Page: The sign up page enables an end user to enter information, such as first name, last name or address to register for purchasing e-books. The sign up page is displayed on clicking the New User? Register hyperlink provided on the login.htm page. Figure 24: Sign Up Form (Code available here)
  • Anil Nembang [L0030BSBS0811] 41 InvalidUser.html: The invalidUser.html page displays a message stating that the user name with the password specified by the end user in Login page does not exist. It is displayed when the end user enters a user name that does not exist or enters wrong password in the login page. Figure 25: InvalidUser
  • Anil Nembang [L0030BSBS0811] 42 Validate .jsp Page: The validate.jsp page validates and stores the information entered by a new user for registration. The Sign up page calls it when an end user enters all the information such as first name, last name or the address and clicks the Submit button. Figure 26: Validate.jsp
  • Anil Nembang [L0030BSBS0811] 43 Search Criteria Page: The SearchCriteria.jsp page enables an end user to select the search criteria, such as book title, author, publisher and category for searching books. The end user needs to enter value for the selected criteria and click the Search button to search the books based on the criteria selected and value entered. Figure 27: Search Criteria Page (Code available here)
  • Anil Nembang [L0030BSBS0811] 44 Search Page: The Search.jsp displays the search results. Detailed information about all the books matching the selected criteria and entered value are displayed on this page. The end user is allowed to select books from the search results and purchase. Figure 28: Search Page (Code available here)
  • Anil Nembang [L0030BSBS0811] 45 New Search Page: The NewSearch.jsp page displays the search results for a new search based on the criteria elected and value entered by the end user. It also displays. The end user is allowed to select books from the search results and purchase. The end user is also allowed to search for more books or filter the search displayed on the current page. Figure 29: New Search Page (Code available here)
  • Anil Nembang [L0030BSBS0811] 46 Purchase Page: The Purchase.jsp page displays the amount for the e-book. This page allows the end user to enter valid credit card number and its expiry date for paying online. Figure 30: Purchase page (Code available here)
  • Anil Nembang [L0030BSBS0811] 47 Logout page: The logout.jsp page invalidates the current session of the end user and contains a hyperlink for the end user to login again. Figure 31: Logout Page (Code available here)
  • Anil Nembang [L0030BSBS0811] 48 Administrative Module: The eBookBag web application enables the end user to administer the information about the e-books available for purchasing . Admin Page: Admin.html page enables the end user to perform various administrative tasks, such as adding new e-books and modifying the details of existing books in the online database. Figure 32: Administrator Page (Code available here)
  • Anil Nembang [L0030BSBS0811] 49 InsertBook Page The AddBook.jsp page displays the message if "Successfully added" if the binary file is inserted while displays "This book already exists " if the book is already in the database. Figure 33: Insert Book Page (Code available here)
  • Anil Nembang [L0030BSBS0811] 50 Modify Page: The modify.jsp page displays the details of all the books available in the online database for purchasing and allows the end user to choose the book whose details are to be modified. Figure 34: Modify Page
  • Anil Nembang [L0030BSBS0811] 51 Gantt Chart: The Project was controlled and monitored by open project. Figure 35: Gantt Chart
  • Anil Nembang [L0030BSBS0811] 52 Conclusion: Some of the features in the project could not be completed because of limited time. Incomplete parts of project are not check marked in the Gantt chart.
  • Anil Nembang [L0030BSBS0811] 53 References: 1. Technet (2012) Project Scope and Objective [Online] Available at: http://technet.microsoft.com/en- us/library/cc960526.aspx [Accessed: 26/01/2013] 2. ShoppingMate (2012) Project Use – Impact [Online] Verified on: http://www.shoppingmate.org/project_use.html [Accessed: 26/01/2013] 3. Richmond R. (Feb 1, 2012) How to Safeguard Online Shopping Transaction [Online] Available at: http://www.entrepreneur.com/article/222701 [accessed: 26/01/2013] 4. Sundararajan A. (3, September 2004) Managing Digital Piracy: Pricing and Protection [Journal] available at: http://dl.acm.org/citation.cfm?id=1045656 http://www.ajml.com.au/downloads/resource-centre/references/operational- management/The%20importance%20of%20record%20keeping.pdf http://msdn.microsoft.com/en-us/library/ms970395.aspx [Accessed: 26/01/2013] 5. Kaufman M. (N/A) The challenge of managing Online Transaction Processing Applications in the Cloud Computing World [Online] verified on: http://www.cloudtran.com/pdfs/CloudOLTP.pdf [Accessed: 26/01/2013] 6. Marley R. (2012) Conducting an Economic Feasibility [Online] Verified on: http://www.fmlink.com/article.cgi?type=How%20To&title=Conducting%20an%20Economic%20Fea sibility%20Analysis&pub=BOMI%20International&id=40863&mode=source [Accessed: 26/01/2013] 7. Ayer S. (16/05/2011) Why a web server? The Benefits of Apache [Online] Verified on: http://www.summa-tech.com/blog/2011/05/16/why-a-web-server-the-benefits-of-apache/ [Accessed; 16/02/2013] 8. Janin M. (2011), Java Projects1st Edition, India: BPB Publication, pg. 214. 9. Travis S. (Dec, 2012)Growth of E-book and E-reader Markets [Online] verifiedon: http://blog.idealo.co.uk/category/consumer-research[Accessed: 6/01/2013] 10. James R. (Tuesday, January 8, 2013)Online boom hurts stores, London: Metro, pg. 9 11. http://coeus.hubpages.com ( June 17, 2012)EBooks Vs. Paper Books: The Pros and Cons [Online] verified on:http://coeus.hubpages.com/hub/Ebooks-Versus-Paper-Books-The-Pros-and-Cons [Accessed: 13/01/2013] 12. Tassi P. (02/03/2012), You will never kill piracy and piracy never kills you [Online] verified on:http://www.forbes.com/sites/insertcoin/2012/02/03/you-will-never-kill-piracy-and-piracy-will- never-kill-you/ [Accessed: 13/01/2013] 13. Dahlstrom D., Farrington H., Gobera D., Roemer R., Schear N. (06/12/2006) Piracy in the digital age [Online] verified on:
  • Anil Nembang [L0030BSBS0811] 54 http://www.cs.washington.edu/education/courses/csep590/06au/projects/digital-piracy.pdf [Accessed: 13/01/2013] 14. Hill W.L. C. (30/01/2007) Digital Piracy: cause, consequence, and strategic responses [Online] Verified on: http://link.springer.com/article/10.1007%2Fs10490-006-9025-0?LI=true#page-1 [Accessed: 13/01/2013] 15. Lamb S. (October 10, 2011) Stunning Statistics on e-book piracy [Online] Verified on: http://allonbooks-thekingdomofallon.blogspot.co.uk/2011/10/stunning-statistics-on-e-book- piracy.html [Accessed: 13/01/2013] 16. Flood A.(02/05/2012) Huge rise in e-book sales offsets decline in printed titles [Online] Verified on: http://www.guardian.co.uk/books/2012/may/02/rise-ebook-sales-decline-print-titles [Accessed: 13/01/2013] 17. Castro D. (December 2009) Steal these policies: Strategies for Reducing Digital Piracy [Online] Verified on: http://www.itif.org/files/2009-digital-piracy.pdf [Accessed: 13/01/2013] 18. Staff Reporter (10/14/2011) eBook piracy rampant but under control, says experts [Online] Verified on: http://memeburn.com/2011/10/ebook-piracy-rampant-but-under-control-say-experts/ [Accessed: 14/01/2013] 19. Engleman E. (30/10/2009) Amazon’s solution for e-book piracy: Fiddling with the text? [Online] Verified on: file:///C:/Users/Anil/Desktop/new%20research%20for%20ARD/Amazon's%20solution%20for%20e- book%20piracy%20%20Fiddling%20with%20the%20text%20%20- %20Puget%20Sound%20Business%20Journal.htm [Accessed: 14/01/2013] 20. Jha A., Singh D., Kapoor D, Agrawal H., Singh N., Agrawal S. (29/03/2010) Inventory management: amazon.com and you are done [Online] Verified on: http://www.slideshare.net/Lordnikhil/inventory-management-amazon [Accessed: 14/01/2013] 21. Southern M. (23/02/2012) what formats does the kindle support? [Online] Verified on: http://techtips.salon.com/formats-kindle-support-4659.html [Accessed: 14/01/2012] 22. Richason E. O. (01/01/2013) How to Prevent E-Book Piracy [Online] Verified on: http://www.ehow.com/how_7614584_prevent-ebook-piracy.html [Accessed: 14/01/2013] 23. Arora D. (12/10/2011) Web based client server technology-A three tier architecture [Online] Verified on: http://gagnesharora.com/ieee2.pdf [Accessed :17/01/2013] 24. W3Techs.com World Wide Web Technology Survey [Online] Verified on: http://w3techs.com/technologies/overview/client_side_language/all [Accessed:17/01/2013] 25. Vermeulen B. (2003-2004) Web Application Technologies [Online] Verified on: http://www.corp21.com/download/WebApplications.pdf [Accessed: 17/01/2013] 26. Kyrnin, J. (12/07/2011) CGI: The Common Gateway Interface [Online] Verified on: http://webdesign.about.com/od/cgi/a/aa021599.htm [Accessed: 19/01/2013] 27. Smith M. (12/03/2012) what is ColdFusion?[Online] Verified on: http://www.fusionauthority.com/cfintro.cfm [Accessed: 19/01/2013]
  • Anil Nembang [L0030BSBS0811] 55 28. Richason E.O. (01/01/2013) How to Prevent E-Book Piracy [Online] Verified on: http://www.ehow.com/how_7614584_prevent-ebook-piracy.html#ixzz2HxXMosMP [Accessed: 19/01/2013] 29. Chesnut R. (03/11/2012) The e-commerce Safety Guide [Online] Verified on: http://www.paypalobjects.com/en_US/pdf/PayPal_Safety.pdf[Accessed: 26/01/2013] 30. Ashford W. (01/06/2010) UK internet users need to be more vigilant as online fraud hits £3.5bn, says Verisign [Online] Verified on: http://www.computerweekly.com/news/1280092905/UK-internet- users-need-to-be-more-vigilant-as-online-fraud-hits-35bn-says-VeriSign [Accessed: 26/01/2013] 31. Java Server Pages overview [Online] Verified on: http://www.oracle.com/technetwork/java/overview-138580.html [Accessed: 02/02/2013] 32. Gaughran D. (ND) E-books Sales Trend [Online] Verified on: : http://ebookcomments.blogspot.co.uk/2012/01/october-2011-e-book-sales.html.[Accessed: 02/02/2013] 33. Infographic Arhive (ND) Online Piracy in Numbers: Facts and statistics [Online] Verified on: :http://www.infographicsarchive.com/interesting-facts/online-piracy-in-numbers-facts- and-statistics/ [Accessed: 26/01/2013 ] 34. Rose India (27/07/2006) Iterative/Incremental Development [Online] Verified on: http://www.roseindia.net/java/java-tips/principles_and_practices/iterative/-sdlc.shtml [Accessed: 27/02/2013] 35. TechTerm.com (ND) BLOB [Online] Verified on: http://www.techterms.com/definition/blob [Accessed: 17/07/2013] 36. Cheng B. (25/02/2011) The Ten Most Pirated eBooks Online [Online] Verified on: http://www.deadendfollies.com/2011/02/ten-most-pirated-ebooks-online-oh.html [Accesed: 19/07/2013] 37. Constant P. (26/02/2011) The Most Pirated e-books is awful [Online] Verified on: http://www.thestranger.com/slog/archives/2011/02/26/the-most-pirated-e-book-list-is- awful&view=comments [Accessed: 19/07/2013] 38. Timlin B. (ND) MySQL Client/Server with java and JDBC [Online] Verified on: http://www.timlin.net/index.php?pg=Youtube.htm [Accessed: 24/04/2013] 39.Turner J. (27/03/2002) MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL Sams Publishing
  • Anil Nembang [L0030BSBS0811] 56 Appendix Coding Upload form page (Demo): <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>File Upload to Database Demo</title> </head> <body> <center> <h1>File Upload to Database Demo</h1> <form method="post" action="uploadServlet" enctype="multipart/form-data"> <table border="0"> <tr> <td>Name: </td> <td><input type="text" name="Name" size="50"/></td> </tr> <tr> <td>Author: </td> <td><input type="text" name="Author" size="50"/></td> </tr> <tr> <td>ISBN: </td> <td><input type="Integer" name="Author" size="50"/></td> </tr> <tr> <td>File: </td> <td><input type="file" name="File" size="50"/></td> </tr> <tr> <td>Description: </td> <td><input type="text" name="Description" size="200"/></td> </tr> <tr> <td colspan="2"> <input type="submit" value="Save">
  • Anil Nembang [L0030BSBS0811] 57 </td> </tr> </table> </form> </center> </body> Test Servlet: package anil.org; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class heloServlet */ @WebServlet("/HeloServlet") public class heloServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); StringBuffer sb=new StringBuffer(); sb.append("<html><body bgcolor=pink text=red>"); sb.append("<h1 align=center>Helo From Anil</h1>"); sb.append("</body></html>"); out.println(sb); out.close(); } } Code for Upload Servlet: package net.codejava.upload;
  • Anil Nembang [L0030BSBS0811] 58 import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @WebServlet("/uploadServlet") @MultipartConfig(maxFileSize = 16177215) // upload file's size up to 16MB public class UploadServlet extends HttpServlet { // database connection settings String url = "jdbc:mysql://localhost:3306/test"; String driver="com.mysql.jdbc.Driver"; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // gets values of text fields String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); InputStream inputStream = null; // input stream of the upload file // obtains the upload file part in this multipart request Part filePart = request.getPart("photo"); if (filePart != null) { // prints out some information for debugging System.out.println(filePart.getName()); System.out.println(filePart.getSize()); System.out.println(filePart.getContentType()); // obtains input stream of the upload file inputStream = filePart.getInputStream(); } Connection conn = null; // connection to the database String message = null; // message will be sent back to client try { // connects to the database
  • Anil Nembang [L0030BSBS0811] 59 conn = DriverManager.getConnection(dbURL, dbUser, dbPass); // constructs SQL statement String sql = "INSERT INTO contacts (first_name, last_name, photo) values (?, ?, ?)"; PreparedStatement statement = conn.prepareStatement(sql); statement.setString(1, firstName); statement.setString(2, lastName); if (inputStream != null) { // fetches input stream of the upload file for the blob column statement.setBlob(3, inputStream); } // sends the statement to the database server int row = statement.executeUpdate(); if (row > 0) { message = "File uploaded and saved into database"; } } catch (SQLException ex) { message = "ERROR: " + ex.getMessage(); ex.printStackTrace(); } finally { if (conn != null) { // closes the database connection try { conn.close(); } catch (SQLException ex) { ex.printStackTrace(); } } // sets the message in request scope request.setAttribute("Message", message); // forwards to the message page getServletContext().getRequestDispatcher("/Message.jsp").forward(request, response); } } } Login.html: <html> <head> <title>Login</title>
  • Anil Nembang [L0030BSBS0811] 60 </head> <body> <CENTER> <H1> <u>eBookBag</u> </H1> </CENTER> <SCRIPT language="JavaScript"> function validate() { if(document.frm.UserName.value==""||document.frm.Password.value=="") { alert("UserName or Password cannot be blank!!"); return; } document.frm.action="Validate.jsp"; document.frm.submit(); } </SCRIPT> <form name = frm method="POST"> <p align="center"><font size="5"><b>Login Form</b></font></p> <TABLE ALIGN="center" height="57"> <TR> <TD >
  • Anil Nembang [L0030BSBS0811] 61 <b>UserName:</b> </TD> <TD > <input type="text" name="UserName" size="20" tabindex="1"> </TD> </TR> <TR> <TD > <b>Password:</b> </TD> <TD > <input type="password" name="Password" size="20" tabindex="2"> </TD> <TR align="center"> <TD colspan=2> <input type="button" value=" Login " name="B1" onclick="validate();" tabindex="3"> </TD> </TR> <TR > <TD ><font size="4">New User?</font></TD> <TD><a href="NewUser.htm"><font size="4">Register</font></a></TD> </TR>
  • Anil Nembang [L0030BSBS0811] 62 </TABLE> </form> </body> </HTML> Sign Up form: Signup Page: <! DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>New User Sign Up</title> </head> <body> <CENTER> <H1><u>eBookBag</u></H1> </CENTER> <formname="form1"method="POST"> <SCRIPTlanguage="JavaScript"> function validate() { if( document.form1.UserName.value=="") { alert("UserName cannot be blank"); return; } if( document.form1.Password.value=="") { alert("Password cannot be blank"); return; } if( document.form1.Password.value!= document.form1.Password2.value) { alert("The two passwords do not match"); return; } if( document.form1.FirstName.value=="") { alert("First Name cannot be blank"); return; } if(document.form1.LastName.value=="") {
  • Anil Nembang [L0030BSBS0811] 63 alert("Last Name cannot be blank"); return; } if( document.form1.Address1.value=="") { alert("Address cannot be blank"); return; } if( document.form1.City.value=="") { alert("City cannot be blank"); return; } if( document.form1.State.value=="Select District") { alert("You must select a state"); return; } if( document.form1.PinCode.value=="") { alert("PinCode cannot be blank"); return; } if( document.form1.Email.value=="") { alert("Email ID cannot be blank"); return; } if( document.form1.Phone.value=="") { alert("Phone Number cannot be blank"); return; } document.forms[0].action="Sign.jsp"; document.forms[0].submit(); } </SCRIPT> <palign="center"> <b><fontsize="5"> New User Registration</font></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p> <palign="left"> &nbsp;<b><fontcolor="#FF0000">( Field marked * are necessary)</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b> </p>
  • Anil Nembang [L0030BSBS0811] 64 <divalign="left"> <tableborder="0"width="100%"> <tr> <tdwidth="23%"><b>User *:</b></td> <tdwidth="77%"> <b> <inputtype="text"name="UserName"size="20"tabindex="1"> </b> </td> </tr> <tr> <tdwidth="23%"> <b> Password*:</b></td> <tdwidth="77%"><b><inputtype="password"name="Password"size="20"tabindex="2"> </b> </td> </tr> <tr> <tdwidth="23%"> <b> Confirm Password*:</b> </td> <tdwidth="77%"><b><inputtype="password"name="Password2"size="20"tabindex="3"> </b> </td> </tr> <tr> <tdwidth="23%"> <b> First Name*:</b></td> <tdwidth="77%"> <b><inputtype="text"name="FirstName"size="20"tabindex="4"> </b> </td> </tr> <tr> <tdwidth="23%"> <b> Middle Name:</b></td> <tdwidth="77%"> <b> <inputtype="text"name="MiddleName"size="20"tabindex="5"> </b> </td> </tr> <tr> <tdwidth="23%"> <b>
  • Anil Nembang [L0030BSBS0811] 65 Last Name*:</b></td> <tdwidth="77%"> <b><inputtype="text"name="LastName"size="20"tabindex="6"> </b> </td> </tr> </table> </div> <divalign="center"> <center> <tableborder="0"width="100%"height="201"> <tr> <tdwidth="23%"height="25"><b>Address1*:&nbsp;&nbsp;</b></td> <tdwidth="77%"height="25"><b><inputtype="text"name="Address1"size="43"tabindex="7"></b></td> </tr> <tr> <tdwidth="23%"height="25"><b>Address2:&nbsp;</b></td> <tdwidth="77%"height="25"><b><inputtype="text"name="Address2"size="43"tabindex="8"></b></td> </tr> <tr> <tdwidth="23%"height="25"><b>City*:&nbsp;</b></td> <tdwidth="77%"height="25"><b><inputtype="text"name="City"size="20"tabindex="9"></b></td> </tr> <tr> <tdwidth="23%"height="25"><b>District*:</b></td> <tdwidth="77%"height="25"><b><selectsize="1"name="District"tabindex="10"> <optionselectedvalue="Select State">Select District</option> <option>Kathmandu</option> <option>Bhaktapur</option> <option>Latitpur</option> <option>Kaski</option> <option>Ilam</option> <option>Morang</option> <option>Sunsari</option> <option>Panchthar</option> </select></b></td> </tr> <tr> <tdwidth="23%"height="25"><b>Municipality*:&nbsp;</b></td> <tdwidth="77%"height="25"><b><inputtype="text"name="PinCode"size="20"tabindex="11"></b></td> </tr> <tr> <tdwidth="23%"height="25"><b>Email ID*:</b></td> <tdwidth="77%"height="25"><b><inputtype="text"name="Email"size="20"tabindex="12"></b></td> </tr> <tr> <tdwidth="23%"height="25"><b>Phone Number*:</b></td> <tdwidth="77%"height="25"><b><inputtype="text"name="Phone"size="20"tabindex="13"></b></td> </tr>
  • Anil Nembang [L0030BSBS0811] 66 <tr> <tdwidth="23%"height="1"></td> <tdwidth="77%"height="1"></td> </tr> <tr> <tdwidth="23%"height="21"></td> <tdwidth="77%"height="21"> <b> <inputtype="submit"value="Submit"name="B1"onclick="validate();"tabindex="13"> </b> </td> </tr> </table> </center> </div> </form> </body> </HTML> SearchCriteria.jsp: <html> <head> <title>Search Items</title> </head> <body bgcolor="#CCFFFF"> <CENTER> <H1> <u>EbookBag</u> </H1> </CENTER> <SCRIPT language="JavaScript"> function startSearch() { if(document.frm.R1[1].checked) { if(document.frm.BookTitle.value=="") { alert("You must enter a book title"); return; } }
  • Anil Nembang [L0030BSBS0811] 67 if(document.frm.R1[2].checked) { if(document.frm.BookAuthor.value=="") { alert("You must enter an author name"); return; } } if(document.frm.R1[3].checked) { if(document.frm.BookPublisher.value=="") { alert("You must enter a publisher name"); return; } } document.frm.action="search.jsp"; document.frm.submit(); } </SCRIPT> <%@ page errorPage="errorpage.jsp" import="java.net.*" %> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <% Connection con = null; PreparedStatement stat = null; ResultSet rs = null; int ctr=0, flag=0; try { private String dbURL = "jdbc:mysql://localhost:3307/AppDB"; private String dbUser = "root"; private String dbPass = "secret"; stat = con.prepareStatement("select * from category_details"); rs=stat.executeQuery(); %> <form name ="frm" method="POST"> <center><font size="5">Search Books</font></p></center> <BR><BR>
  • Anil Nembang [L0030BSBS0811] 68 <table border="0" width="100%" height="196"> <tr> <td width="17%" align="right" height="25"><input type="radio" value="Category" checked name="R1"></td> <td width="32%" height="25">Search by Category</td> <td width="51%" height="25"> <select size="1" name="BookCategory"> <option selected value="Select">Select Category</option> <% while(rs.next()) { String category=rs.getString(2);%> <option value="<%=category%>"><%=category%></option> <%}%> </select> </td> </tr> <tr> <td width="17%" align="right" height="25"><input type="radio" name="R1" value="Title"></td> <td width="32%" height="25">Search by Book Title</td> <td width="51%" height="25"><input type="text" name="BookTitle" size="25"></td> </tr> <tr> <td width="17%" align="right" height="25"><input type="radio" name="R1" value="Author"></td> <td width="32%" height="25">Search by Book Author</td> <td width="51%" height="25"><input type="text" name="BookAuthor" size="25"></td> </tr> <tr> <td width="17%" align="right" height="25"><input type="radio" name="R1" value="Publisher"></td> <td width="32%" height="25">Search by Book Publisher</td> <td width="51%" height="25"><input type="text" name="BookPublisher" size="25"></td> </tr> <tr> </tr> <tr> <td width="17%" align="right" height="21"></td> <td width="32%" height="21">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value=" Search " name="Search" onClick="startSearch();"></td> <td width="51%" height="21"><a href="Logout.jsp">Click here to logout</a></td> </tr> </table> </form> <% } catch(Exception e) { out.print("Error = " + e + "<HR>"); }
  • Anil Nembang [L0030BSBS0811] 69 Finally { rs.close(); con.close(); } %> </body> </html> Search Page: <%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %> <html> <head> <title>Search Results</title> </head> <body> <CENTER> <H1> <u>eBookBag</u> </H1> <font size="5" >Search Results</font> </CENTER> <BR> <a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a> <% String str_searchvar=null; int chk_ctr=0; String str_colvar=null; String tab_var=""; String user_src=(String)session.getValue("user"); System.out.println("0"); if (user_src!=null) { String query=null; Connection conn; conn=null; ResultSet rs; rs=null; if(request.getParameter("R1").equals("Title")) { str_searchvar=request.getParameter("BookTitle"); str_colvar="TITLE"; } if(request.getParameter("R1").equals("Category")) { chk_ctr=1; str_searchvar=request.getParameter("BookCategory"); str_colvar="Categoryname";
  • Anil Nembang [L0030BSBS0811] 70 } if(request.getParameter("R1").equals("Publisher")) { str_searchvar=request.getParameter("BookPublisher"); str_colvar="Publisher"; } if(request.getParameter("R1").equals("Author")) { str_searchvar=request.getParameter("BookAuthor"); str_colvar="Author"; } if (request.getParameter("R2")==null) { tab_var="BOOK_DETAILS"; } else { // to get the name of the table in which the search to be done------- if (request.getParameter("R2").equals("A")) { tab_var="TEMP_DETAIL"; } else { tab_var="BOOK_DETAILS"; } } System.out.println(str_searchvar); query = "select a.* from "+tab_var+" a, category_details b where a."+str_colvar+" = ? and a.CATEGORYID = b.CATEGORYID"; System.out.println("1"); try { String url = "jdbc:mysql://localhost:3306/test"; String driver="com.mysql.jdbc.Driver"; int ctr=0; System.out.println("2"); PreparedStatement stm = conn.prepareStatement(query); stm.setString(1,str_searchvar); rs = stm.executeQuery(); %> <form name="cart" action="Inter_Cart.jsp" method="POST"> <table border=1> <tr> <td>S.No</td> <td>Select</td> <td>Book Name</td>
  • Anil Nembang [L0030BSBS0811] 71 <td>Author Name</td> <td>Publisher</td> <td>Edition</td> <td>Price (in Rs.)</td> <td>Description</td> </tr> <% while(rs.next()) { System.out.println("inside while"); ctr=ctr+1; out.println("<tr><td>"+ctr+"</td>"); int int_BOOKID=0; int_BOOKID=rs.getInt(1); System.out.println(int_BOOKID); out.println("<td><input type=checkbox name=chk"+ctr+" value="+int_BOOKID+">"); int int_CATEGORYID=rs.getInt(2); String str_TITLE=rs.getString(3); out.println("<td>"); out.println(str_TITLE); out.println("</td>"); String str_AUTHOR=rs.getString(4); out.println("<td>"); out.println(str_AUTHOR); out.println("</td>"); String str_PUBLISHER=rs.getString(5); out.println("<td>"); out.println(str_PUBLISHER); out.println("</td>"); String str_EDITION=rs.getString(6); out.println("<td>"); out.println(str_EDITION); out.println("</td>"); int int_PRICE=rs.getInt(7); out.println("<td>"); out.println(int_PRICE); out.println("</td>"); int int_QUANTITY=rs.getInt(8); out.println("<td>");
  • Anil Nembang [L0030BSBS0811] 72 out.println(int_QUANTITY); out.println("</td>"); String str_DESCRIPTION=rs.getString(9); out.println("<td>"); out.println(str_DESCRIPTION); out.println("</td></tr>"); String ins_query ="INSERT INTO temp_detail VALUES (?,?,?,?,?,?,?,?,?)"; PreparedStatement stat_ins= conn.prepareStatement(ins_query); stat_ins.setInt(1,int_BOOKID); stat_ins.setInt(2,int_CATEGORYID); stat_ins.setString(3,str_TITLE); stat_ins.setString(4,str_AUTHOR); stat_ins.setString(5,str_PUBLISHER); stat_ins.setString(6,str_EDITION); stat_ins.setInt(7,int_PRICE); stat_ins.setInt(8,int_QUANTITY); stat_ins.setString(9,str_DESCRIPTION); int x = stat_ins.executeUpdate(); System.out.println(x); } String str_ctr=String.valueOf(ctr); session.putValue("ctr_val",str_ctr); %> </table> <br> <input type="submit" value=" BUY " name="Add"> </form> <% rs.close(); stm.close(); } catch(Exception e){} } else { response.sendRedirect("Unauthorised.htm"); } %> </body> </html>
  • Anil Nembang [L0030BSBS0811] 73 New Search Page <html> <head> <title>Search Results</title> </head> <body> <CENTER> <H1> <u>eBookBag</u> </H1> </CENTER> <BR> <a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a> <%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %> <% String user_src=(String)session.getValue("user"); if (user_src!=null) { String str_searchvar=null; String str_colvar=null; String query=""; String tab_var=""; int total_sel=Integer.parseInt((String)session.getValue("TotalSel")); int[] old_bookid=new int[total_sel]; Connection conn; conn=null; ResultSet rs; rs=null; String url = "jdbc:mysql://localhost:3306/test"; String driver="com.mysql.jdbc.Driver"; PreparedStatement stat=null,stat_ins=null,stat_del=null; for (int i=1;i<=total_sel;i++) { old_bookid[i-1]=Integer.parseInt((String)session.getValue("chk_var"+i)); }%> <h3>Your Cart Details are as follows:</h3> <form name="shop" action="Cart_quantity.jsp"> <table border=1> <tr> <td>S.No</td> <td>Book Name</td> <td>Price (in Rs.)</td> </tr> <%
  • Anil Nembang [L0030BSBS0811] 74 int price=0; int bookprice=0; for (int j=0;j<total_sel;j++) { out.println("<tr><td>"+j+1); query="select title, price from book_details where bookid=?"; stat= conn.prepareStatement(query); stat.setInt(1,old_bookid[j]); rs = stat.executeQuery(); while (rs.next()) { out.println("<td>"); out.println(rs.getString(1)); out.println("<td>"); price=rs.getInt(2); out.println(price); } rs.close(); bookprice=bookprice+price; out.println("</tr>"); }%> <tr> <td colspan=3>Total Cart Amount(in Rs.)= <%=bookprice%> <td></tr> </table> <br> <input type=submit value="Place Order"> </form> <% String test_src=null; int chk_ctr=0; if(request.getParameter("R1").equals("Title")) { str_searchvar=request.getParameter("BookTitle"); str_colvar="Title"; } if(request.getParameter("R1").equals("Category")) { chk_ctr=1; str_searchvar=request.getParameter("BookCategory"); str_colvar="Categoryname"; }
  • Anil Nembang [L0030BSBS0811] 75 if(request.getParameter("R1").equals("Publisher")) { str_searchvar=request.getParameter("BookPublisher"); str_colvar="Publisher"; } if(request.getParameter("R1").equals("Author")) { str_searchvar=request.getParameter("BookAuthor"); str_colvar="Author"; } String ss = request.getParameter("R2"); if (request.getParameter("R2")==null) { tab_var="book_details"; } else { // to get the name of the table in which the search to be done------- if (request.getParameter("R2").equals("A")) { tab_var="temp_detail"; } else { tab_var="book_details"; } } //-------- whether search is by category or other criteria----------- if (chk_ctr==0) { query="select a.* from "+tab_var+" a, category_details b where a."+str_colvar+" = ? and a.CATEGORYID = b.CATEGORYID"; } else { query="SELECT a.*,b.categoryname FROM "+tab_var+" a,CATEGORY_DETAILS b where b."+str_colvar+"=? and a.categoryid=b.categoryid"; } try { stat=conn.prepareStatement(query); stat.setString(1,str_searchvar);
  • Anil Nembang [L0030BSBS0811] 76 rs = stat.executeQuery(); int ctr=0;%> <h3>Search Results are as follows:</h3> <form name="cart" action="NewInter_cart.jsp" method="POST"> <table border=1> <tr> <td>S.No</td> <td>Select</td> <td>Book Name</td> <td>Author Name</td> <td>Publisher</td> <td>Edition</td> <td>Price (in Rs.)</td> <td>ISBN</td> <td>Description</td> </tr> <% String delete_query="Delete from TEMP_DETAIL"; stat_del= conn.prepareStatement(delete_query); String ins_query=null; int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY; String str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION; int rs_del=stat_del.executeUpdate(); while(rs.next()) { ctr=ctr+1; out.println("<tr><td>"+ctr); int_BOOKID=rs.getInt(1); out.println("<td><input type=checkbox name=chk"+ctr+" value="+int_BOOKID+">"); int_CATEGORYID=rs.getInt(2); str_TITLE=rs.getString(3); out.println("<td>"); out.println(str_TITLE); str_AUTHOR=rs.getString(4); out.println("<td>"); out.println(str_AUTHOR); str_PUBLISHER=rs.getString(5); out.println("<td>"); out.println(str_PUBLISHER);
  • Anil Nembang [L0030BSBS0811] 77 str_EDITION=rs.getString(6); out.println("<td>"); out.println(str_EDITION); int_PRICE=rs.getInt(7); out.println("<td>"); out.println(int_PRICE); int_QUANTITY=rs.getInt(8); out.println("<td>"); out.println(int_QUANTITY); str_DESCRIPTION=rs.getString(9); out.println("<td>"); out.println(str_DESCRIPTION); out.println("</tr>"); ins_query="INSERT INTO TEMP_DETAIL VALUES(?,?,?,?,?,?,?,?,?)"; stat_ins=conn.prepareStatement(ins_query); stat_ins.setInt(1,int_BOOKID); stat_ins.setInt(2,int_CATEGORYID); stat_ins.setString(3,str_TITLE); stat_ins.setString(4,str_AUTHOR); stat_ins.setString(5,str_PUBLISHER); stat_ins.setString(6,str_EDITION); stat_ins.setInt(7,int_PRICE); stat_ins.setInt(8,ISBN); stat_ins.setString(9,str_DESCRIPTION); int rs_ins=stat_ins.executeUpdate(); } String str_ctr=String.valueOf(ctr); session.putValue("ctr_val",str_ctr); %> </table> <input type="submit" value=" Purchase " name="Add"> </form> <% ResultSet rscombo=null;
  • Anil Nembang [L0030BSBS0811] 78 String query1="select * from category_details"; PreparedStatement stat_combo = conn.prepareStatement(query1); rscombo=stat_combo.executeQuery();%> <br><h3>Search Results are as follows:</h3> <form name="newsrc" action="NewSearch.jsp" method="POST"> <table border=1> <tr> <td><input type="radio" value="Category" checked name="R1"></td> <td>Search based on Category</td> <td> <select size="1" name="BookCategory"> <option selected value="Select">Select Category</option> <% while(rscombo.next()) { String category=rscombo.getString(2); %> <option value="<%=category%>"><%=category%></option> <%}%> </select> </td> </tr> <tr> <td><input type="radio" name="R1" value="Title"></td> <td>Search by Book Title</td> <td><input type="text" name="BookTitle" size="25"></td> </tr> <tr> <td><input type="radio" name="R1" value="Author"></td> <td>Search by Book Author</td> <td><input type="text" name="BookAuthor" size="25"></td> </tr> <tr> <td><input type="radio" name="R1" value="Publisher"></td> <td>Search by Book Publisher</td> <td><input type="text" name="BookPublisher" size="25"></td> </tr> <tr> <td><input type="radio" name="R2" value="A">Advanced Search</td> <td><input type="radio" name="R2" value="N" checked>New Search</td> <td><input type=submit value="Search"></td> </tr> </table> </form> <%} catch(Exception E)
  • Anil Nembang [L0030BSBS0811] 79 { out.println("Error "+E); } finally{conn.close();} } else { response.sendRedirect("Unauthorised.htm"); } %> </body> </html> Purchase Page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Purchase Details</title> </head> <body> <CENTER> <H1> <u>eBookBag</u> </H1> </CENTER> <BR> <a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a> <%@ page errorPage="errorpage.jsp" language="java" import="java.sql.*" %> <% if (session.getValue("user")!=null) {%> <script language="Javascript"> function validate() { var r = document.form1; var creditcard=r.Card.value; var year = r.Year.value; var month = r.Month.value; var day = r.Day.value; if(creditcard.length!=16) { alert("Invalid Credit Card Number"); r.Card.focus(); return;
  • Anil Nembang [L0030BSBS0811] 80 } //----------------------------------------------------------------------- if(day=="Select Day") { alert("Please select the day"); r.Day.focus(); return; } //----------------------------------------------------------------------- if(month=="Select Month") { alert("Please select the month"); r.Month.focus(); return; } //----------------------------------------------------------------------- if(year.length==0) { alert("Please enter the year"); r.Year.focus(); } else if (year.length!=4) { alert("Please enter the year in YYYY format"); r.Year.focus(); } //----------------------------------------------------------------------- if (( month == "3" || month == "5" || month == "8" || month == "10") && (day == "31")) { alert("Please enter a valid date"); r.Day.focus(); } if ((month == "1") && (day == "30" || day == "31")) { alert("Please enter a valid date"); r.Day.focus(); } //------- To check that card date is not less than current date---------- var vr_day; var vr_month; var vr_year; var d=new Date(); vr_year=d.getFullYear(); vr_month=d.getMonth(); vr_day=d.getDate(); if(parseInt(vr_year)>parseInt(document.form1.Year.value))
  • Anil Nembang [L0030BSBS0811] 81 { alert("Year cannot be less than Current Year"); return false; } else if(parseInt(vr_year)==parseInt(document.form1.Year.value)) { if(parseInt(vr_month)>parseInt(document.form1.Month.value)) { alert("Month cannot be less than Current Month"); return false; } else if(parseInt(vr_month)==parseInt(document.form1.Month.value)) { if(parseInt(vr_day)>parseInt(document.form1.Day.value)) { alert("Day cannot be less than current Day"); return false; } } } //------------------------------------------------------------------------ document.form1.submit(); document.forms[0].action="Final.jsp"; } </script> <% int counter=0; counter=Integer.parseInt((String)session.getValue("TotalSel")); String query=""; int[] bookid=new int[counter]; int[] bk_price=new int[counter]; int[] bk_quantity=new int[counter]; Connection conn; conn=null; ResultSet rs; rs=null; String url = "jdbc:mysql://localhost:3306/test"; String driver="com.mysql.jdbc.Driver"; PreparedStatement stat=null; int ctr=0,bookprice=0; int i=1; while(i<=counter) { if((String)session.getValue("chk_var"+i)!=null) { bookid[i-1]=Integer.parseInt((String)session.getValue("chk_var"+i));
  • Anil Nembang [L0030BSBS0811] 82 query="SELECT PRICE FROM BOOK_DETAILS WHERE BOOKID=?"; stat=conn.prepareStatement(query); stat.setInt(1,bookid[i-1]); rs=stat.executeQuery(); if(rs.next()) { bk_price[i-1]=rs.getInt(1); } else { bk_price[i-1]=0; } } if(request.getParameter("qty"+i)!=null) { bk_quantity[i-1]=Integer.parseInt(request.getParameter("qty"+i)); String sess_var=String.valueOf(bk_quantity[i-1]); session.putValue(sess_var,String.valueOf(bk_quantity[i-1])); } bookprice=bookprice+(bk_price[i-1]*bk_quantity[i-1]); i++; } session.putValue("bPrice",String.valueOf(bookprice)); %> <form method="POST" action="Final.jsp" name="form1"> <table width="70%"> <tr> <td colspan=4 ><b>Total Amount (in Rs.) is : <%=bookprice%></b></td></tr> <tr> </tr> <tr> <td><font size="3"><b>Credit Card Number: </b></font></td> <td colspan=3> <input type="text" name="Card" size="39" maxlength="16" tab="1"></td> </tr> <tr> <td><font size="3"><b>Expiry Date : </b></font></td> <td> <select size="1" name="Day"> <option value="Select Day">Select Day</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option>
  • Anil Nembang [L0030BSBS0811] 83 <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> </td> <td> <select size="1" name="Month"> <option value="Select Month">Select Month</option> <option value="0">January</option> <option value="1">February</option> <option value="2">March</option> <option value="3">April</option> <option value="4">May</option> <option value="5">June</option> <option value="6">July</option> <option value="7">August</option> <option value="8">September</option> <option value="9">October</option> <option value="10">November</option> <option value="11">December</option> </select> </td> <td> <font size="3"><input type="text" name="Year" size="11"></font>
  • Anil Nembang [L0030BSBS0811] 84 </td> </tr> </table> </font><input type="button" value="Submit" name="B1" onClick="validate();" > </form> <% } else { response.sendRedirect("Unauthorised.htm"); }%> </body> </html> Download Servlet: import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Download extends HttpServlet { /* Handle the HTTP GET method by building a simple web page. */ private static final long serialVersionUID = 1L; public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int id = Integer.parseInt(request.getParameter("fileId")); String url = "jdbc:mysql://localhost:3306/test"; String sql = "SELECT file_size, file_name, file_bytes FROM documents WHERE file_id = ?"; Connection conn = null; PreparedStatement prep = null; try { DriverManager.registerDriver(new com.mysql.jdbc.Driver());
  • Anil Nembang [L0030BSBS0811] 85 conn = DriverManager.getConnection(url, null, null); //conn.setAutoCommit(false); // SET AUTOCOMMIT OFF!! prep = conn.prepareStatement(sql); prep.setInt (1, id); ResultSet rs = prep.executeQuery(); Logger.debug(String.format("File-ID: %d", id)); if (!rs.next()) return; int fileSize = rs.getInt(1); String fileName = rs.getString(2); int iByte; InputStream is = rs.getBinaryStream(3); if (is == null) return; response.setContentType ("application/txt"); response.setHeader ("Content-Disposition", "attachment;filename=""+fileName+"""); java.io.OutputStream fos = response.getOutputStream(); while ((iByte = is.read()) != -1) fos.write(iByte); conn.close(); } catch(Exception ex) { //return "Error: "+ex.getMessage(); } finally { } } public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } } Logout Page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Logged out</title> </head> <body>
  • Anil Nembang [L0030BSBS0811] 86 <CENTER> <H1> <u>eBookBag</u> </H1> </CENTER> <%@ page errorPage="errorpage.jsp" language="java" %> <% session.invalidate(); %> <center> <BR><BR><BR><BR><b>You have logged out successfully. <BR><BR>Return to eBookBag <a href="Login.htm">Click here</a></b> </center> </body> </html> Admin Page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <TITLE>Administering eBookBag</TITLE> </HEAD> <BODY> <CENTER> <H1>Administering eBookBag </H1> </CENTER> <br><hr><br><br> <h2>Welcome Administrator</h2><br> <Form name="admin" method="POST"> <TABLE width=100% border="0" cellpadding="2" cellspacing="0"> <TR> <th align = "left" width="4%"></th> <th align = "left" width="20%"></th> <th align = "left" width="38%"></th> <th align = "left" width="38%"></th> </TR> <TR> <TH>1</TH> <TH align = "left">Book</TH> <TH><a href="Insert.jsp">Insert New Book</a></TH> <TH><a href="Modify.jsp">Modify Book Details</a></TH> </TR> </BODY> </HTML> InsertBook Page:
  • Anil Nembang [L0030BSBS0811] 87 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <TITLE>Insert New Book</TITLE> </HEAD> <BODY> <CENTER> <H1> <u>Administering E-BookBag</u> </H1> <H2> Add Book</H2> </CENTER> <BR> <HR> <BR> <a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a> <BODY> <SCRIPT language="Javascript"> function check() { var ctr=0; if(document.addbook.title.value=="") { alert("Please Enter Title"); return; } if(document.addbook.author.value=="") { alert("Please Enter Author"); return; } if(document.addbook.pub.value=="") { alert("Please Enter Publisher Name"); return; } if(document.addbook.edition.value=="") { alert("Please Enter Edition"); return; } if(document.addbook.price.value=="") { alert("Please Enter Price (in Rs.)"); return; } }
  • Anil Nembang [L0030BSBS0811] 88 if(document.addbook.desc.value=="") { alert("Please Enter Description"); return; } if(isNaN(document.addbook.price.value)) { alert("Please Enter a numeric value for Price (in Rs.)"); ctr=1; } if(isNaN(document.addbook.qty.value)) { alert("Please Enter a numeric value for Quantity"); ctr=1; } if(ctr==0) { document.forms[0].action="AddBook.jsp"; document.forms[0].submit(); } else { return true; }; } </SCRIPT> <%@ page errorPage="errorpage.jsp" import="java.net.*" %> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <% Connection con = null; //Statement stat = null; PreparedStatement stat = null; //Statement stat1 = null; PreparedStatement stat1 = null; ResultSet rs = null; ResultSet rs1 = null; String query=null; String query1=null; int ctr=0, flag=0; try { String url = "jdbc:mysql://localhost:3306/test"; String driver="com.mysql.jdbc.Driver"; query="Select a.*,b.categoryname from book_details a, category_details b where a.categoryid=b.categoryid";
  • Anil Nembang [L0030BSBS0811] 89 query1="select * from category_details"; stat = con.prepareStatement(query); stat1 = con.prepareStatement(query1); rs=stat.executeQuery(); rs1=stat1.executeQuery(); %> <br><h3>List of Available Books:</h3> <table border=1> <tr> <td>S.No</td> <td>Book Id</td> <td>Book Name</td> <td>Author Name</td> <td>Publisher</td> <td>Edition</td> <td>Price (in Rs.)</td> <td>Quantity Available(Nos.)</td> <td>Description</td> <td>Category</td> </tr> <% int int_BOOKID,int_CATEGORYID,int_PRICE; String str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION; while(rs.next()) { ctr=ctr+1; out.println("<tr><td>"+ctr); int_BOOKID=rs.getInt(1); out.println("<td>"); out.println(int_BOOKID); int_CATEGORYID=rs.getInt(2); str_TITLE=rs.getString(3); out.println("<td>"); out.println(str_TITLE); str_AUTHOR=rs.getString(4); out.println("<td>"); out.println(str_AUTHOR); str_PUBLISHER=rs.getString(5); out.println("<td>"); out.println(str_PUBLISHER);
  • Anil Nembang [L0030BSBS0811] 90 str_EDITION=rs.getString(6); out.println("<td>"); out.println(str_EDITION); int_PRICE=rs.getInt(7); out.println("<td>"); out.println(int_PRICE); str_DESCRIPTION=rs.getString(9); out.println("<td>"); out.println(str_DESCRIPTION); out.println("<td>"); out.println(rs.getString(10)); out.println("</tr>"); } out.println("</table>");%> <br> <hr> <h3> Add New Book Details</h3> <form name="addbook"> <table border=1> <tr><td>Book Title</td><td><input type="text" name="title"></td> <tr><td>Author Name</td><td><input type="text" name="author"></td> <tr><td>Publisher</td><td><input type="text" name="pub"></td> <tr><td>Edition</td><td><input type="text" name="edition"></td> <tr><td>Price (in Rs.)</td><td><input type="text" name="price"></td> <tr><td>Description</td><td><input type="text" name="desc"></td> <tr><td>Category</td><td><select size="1" name="cat"> <% while(rs1.next()) {%> <option value="<%=rs1.getString(1)%>"><%=rs1.getString(2)%></option> <%}%> </select></td> </tr> <tr><td><input type="submit" value=" Add " onClick="check();"></td> <td><input type="Reset" value=" Clear "></td> </table> </form> <% } catch(Exception e) { out.print("Error = " + e + "<HR>"); } %> </BODY>
  • Anil Nembang [L0030BSBS0811] 91 </HTML> Modify Page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <TITLE>Modify Book Details</TITLE> </HEAD> <BODY> <CENTER> <H1> Administering E-BookBag</H1> <H2>Modify Book Details</H2> </CENTER> <BR> <HR> <BR> <BR> <a href="Logout.jsp" ><font size="4" >Click here to Logout</font></a> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <% Connection con = null; PreparedStatement stat = null; ResultSet rs = null; String query=null; int ctr=0; try { String url = "jdbc:mysql://localhost:3306/test"; String driver="com.mysql.jdbc.Driver"; query="Select a.*,b.categoryname from book_details a, category_details b where a.categoryid=b.categoryid"; stat = con.prepareStatement(query); rs=stat.executeQuery(); %> <br><h3>List of Available Books:</h3> <form name="Mod" action="Modify_Book.jsp">
  • Anil Nembang [L0030BSBS0811] 92 <table border=1> <tr> <td>S.No</td> <td>Book Id</td> <td>Book Name</td> <td>Author Name</td> <td>Publisher</td> <td>Edition</td> <td>Price (in Rs.)</td> <td>Quantity Available(Nos.)</td> <td>Description</td> <td>Category</td> </tr> <% int int_BOOKID,int_CATEGORYID,int_PRICE,int_QUANTITY; String str_TITLE,str_AUTHOR,str_PUBLISHER,str_EDITION,str_DESCRIPTION; while(rs.next()) { ctr=ctr+1; out.println("<tr><td>"+ctr); int_BOOKID=rs.getInt(1); out.println("<td>"); out.println("<input type=radio name=R1 value="+int_BOOKID+">"); int_CATEGORYID=rs.getInt(2); str_TITLE=rs.getString(3); out.println("<td>"); out.println(str_TITLE); str_AUTHOR=rs.getString(4); out.println("<td>"); out.println(str_AUTHOR); str_PUBLISHER=rs.getString(5); out.println("<td>"); out.println(str_PUBLISHER); str_EDITION=rs.getString(6); out.println("<td>"); out.println(str_EDITION); int_PRICE=rs.getInt(7); out.println("<td>"); out.println(int_PRICE); int_QUANTITY=rs.getInt(8); out.println("<td>"); out.println(int_QUANTITY);
  • Anil Nembang [L0030BSBS0811] 93 str_DESCRIPTION=rs.getString(9); out.println("<td>"); out.println(str_DESCRIPTION); out.println("<td>"); out.println(rs.getString(10)); out.println("</tr>"); } %> <tr> <td><input type="submit" value=" Modify "></td> <td><input type="Reset" value=" Clear "></td> </tr> </table> </form> <% } catch(Exception e) { out.print("Error = " + e + "<HR>"); } %> </BODY> </HTML> ody> </body> </html> ---Thank You---