Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 27th, 2004, 01:23 PM
sewage sewage is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 50 sewage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 35 sec
Reputation Power: 5
Question JSP and inventory

I am new to Java and so am not sure how to go about solving a problem. I would like to setup
a shop here on the internet, but I am worried about mulitple people paying for an item that is already out of stock.
So I thought I could just create a database with the inventory, and then state the number of items left in stock on the
website. Although I am unsure as to how the database should be updated once a person actually buys somthing. I want
the databse to only be updated when an item is actually sold not when the customer clicks on the buy now button then leaves
without actually buying the item.

I plan on using JSP and mySQL to fullfill my needs. Any ideas on how I should go about doing this.

Reply With Quote
  #2  
Old July 14th, 2004, 02:47 PM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
One advice : don't use JSP's and mySQL only. Instead, use JSP's, servlets, java beans and mySQL. Or, in other words, use the Model-View-Controller pattern to write your application. If this seems too much and an overload of work, think of it as a very good basis for extending your application when part of it is already in production.
With just plain JSP's, you can get the work done, but maintaining or extending the application won't be easy.

If you want to know more about servlets and JSP's, go to the website of Marty Hall : www.coreservlets.com. There is a free donwloadable pdf-version of his book "core servlets and Java Server Pages". You'll read all about the collaboration between servlets and JSP's.

About your problem of buying some items : take a look at how amazon.com works. You can pick up some books and put them in your shopcart. But only when you push the button "buy now", you get a screen with all the items you've purchased. On that screen you can decide to leave some items at the shop, add some more or just pay by accepting the order as it is. At that moment, you can creat an order in your database, with an orderline for every purchased item. At that moment, you can adapt the number of items in your stock.

But you can do it in a simpler, perhaps more dangerous way : only at the moment the purchased items leave the stock, ready for transport to the customer, you can subtract the number of items from the total number in stock. With this, you're sure that only one dispatcher uses the programs and therefore there is just one user adapting the number of items in stock. The disadvantage of this is that customers can buy items that are not in stock. But let me be the devil's advocate : why worry about this if you can add the wanted items wuikcly enough to your stock. let them wait a little longer and you will have sold more.

Anyway, before beginning , take a look at servlets as well. It seems like a loss of time but you will gain it afterwards.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > JSP and inventory


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT