I am doing my project on a shopping cart. i have a little problem! ive got 2 tables..products and tempcart. The products table contains the fields idnumber and all the rest of the product information (such as title, description). The tempcart table has 2 fields. sessionid and idnumber. Each time a user selects an item, the idnumber and the sessionid is inserted into the tempcart. It works so far!! however the problem is i want to find out what products has that particular user selected during that session not products selected by all users. At the moment when the user selects a product they want to purchase i get a blank page of the cart and does not show the product details. the code i am usinmg is as follows:
1. Could the problem be on any of your other pages ? In particular, it might help if you list your "list.jsp" (assuming that's the one that allows users to add items to their shopping cart).
2. Is there a special reason why you chose to use a hidden field to deliver the sessionID to/from the browser ? To the best of my knowledge this approach is a bit un-usual : people usually prefer to just call:
and rely on the session ID to travel *automatically* between client and server, relying on either cookies or "url rewrites" (it does, however, mean that either you ask your users to enable cookies on their browser, or you use the "encodeURL" statement whenever you render a link).
Joined: Jan 01, 2005
thanks so much that worked im passing most values that i need from one jsp page to another in hidden fields, is there are a better way of doing it?
Passing parameters between pages: it might be useful to store shared data under your "session" (or under "application", if you'd like the datum to be viewed by *all users*, not just by the user who entered it). A simple example : http://www.jsptut.com/Sessions.jsp
you might also want to have a look at the apache Struts framework (or the new "Java Server Faces" ). It involves *considerably* more work (deploying jar files, creating java classes, editing xml files), and I would *not* recommend it for a very simple test program. But my company does use it for "real world" applications, where it proved priceless.