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.