Input field in always receives value of last item in list

后端 未结 3 745
终归单人心
终归单人心 2021-01-23 11:23

I have a displaying a product catalog in Proudcts.xhtml:


    

        
3条回答
  •  再見小時候
    2021-01-23 11:51

    Each line of your h:datatable references the same variable ViewProductsManagedBean.quantityPurchased. If the form is submitted, the value of ViewProductsManagedBean.quantityPurchased will be set for each line again and again. That's why the value of the last row defines the final state of quantityPurchased and this is the value you get in your method.

提交回复
热议问题