我试图打印在 inputText 中输入的值,但它只显示 0 除了最后一行显示正确的值!这是一个最小的代码(我没有包括所有的字段和 getter/setter)
@ManagedBean(name="medicament")
@ViewScoped
public class MedicamentBean {
private List<Medicament> medicaments;
private String libelle;
private int qte_vente;
public void test() {
System.out.println(this.qte_vente);
}
}
html:
<h:form>
<p:dataTable value ="#{medicament.medicaments}" var ="m">
<p:column headerText="libelle">
<h:outputText value = "#{m.libelle}"/>
</p:column>
<p:column headerText="qte">
<h:inputText value ="#{medicament.qte_vente}" onkeyup="myCommand();"/>
<p:remoteCommand name="myCommand" actionListener="#{medicament.test()}" style="display: none;"
/>
</p:column>
</p:dataTable>
</h:form>