Helpful Information
 
 
Category: Java Help
Checkboxes in JSP - need mutiple values

I'm working on a shopping cart that I want to use a multiple number of checkboxes and then one "Add to Cart" button. I want to pass a part number, part description and quantity to a servlet for each part selected. I'm not sure if I can pass multiple values. I know in the servlet I pass the name of the checkbox and use request.getParameterValues("SelectedParts") which returns a String array. Then use a loop to get the elements of the array. What if you want more than one value? Use a multiple dimensional array maybe? Can anyone help?

Thanks.

her i am developing a shopping cart application, but failed to get the data from the forms using check boxes,so will u plz help me

well why do you want to pass all that data?

I'm assuming you are (or will eventually) use a database. just pass in the part number and thats all you really need. If your gonna build cookies or do whatever you can just check the database or whatever based on the product number (which i'm assuming is acting like a key) and you should be able to get all your info that way.










privacy (GDPR)