<h: inputText> scheint in <ui: repeat> nicht zu funktionieren, nur der letzte Eintrag wird gesendet

ich habe ein<ui:repeat> mit<ui:inputText>:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"    
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="./templates/masterLayout.xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="content">
        <ui:repeat value="#{genproducts.dbList()}" var="itemsBuying">
            <div class="indproduct">
                <p class="center">#{itemsBuying.name}</p>
                <div class="center">
                    <h:form style="margin-left: auto; margin-right: auto;">
                        <h:inputText value="#{itemsBuying.amount}" />
                        <h:commandLink action="#{shoppingCart.addToCart(itemsBuying)}" value="add" />
                    </h:form>
                </div> 
            </div>
        </ui:repeat>
    </ui:define>
</ui:composition>

Dies ist das#{genproducts} Hintergrundbohne:

@ManagedBean(name = "genproducts")
@ViewScoped
public class Genproducts{

    public List<Product> dbList() throws SQLException {
        List<Product> list = new ArrayList<>();
        ...
        return list;
    }

} 

Dies ist dasProduct Entität:

@ManagedBean(name = "product")
@RequestScoped
public class Product {

    private int amount;

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

}

In meinem Fall gibt es vier Produkte vondbList() Methode. Wenn ich für die ersten drei Produkte einen anderen Wert eingebe, wird der Standardwert in der Aktionsmethode angezeigt. Nur für das letzte Produkt funktioniert es wie erwartet.

Wie entsteht das und wie kann ich es lösen?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage