The problem is that you are binding a single bean to the components of each row in your table. If you have multiple rows and in the first one you select 3 in the dropdown box and press "add to shopping cart", then if there is another row with 1 selected in the dropdown box, the bean will get updated to 1 (prcisely: firstly it will get updated according to the first row to 3, then according to the second row to 1, and so on).
I believe that this is the source of your problems.
One solution would be to create an object like:
class ProductPurchase{
Necklace necklace;
int amount;
}
change the List<Product>
to List<ProductPurchase>
, bind the drop down list value to necklace.amount
and set the action of "add to cart" to action="#{necklaceBean.addToShoppingCart(necklace)"
.