Pessoal, gostaria que alguém me ajudasse por favor.
Tenho meu DTO:
public class Valores {
private String valor;
private String multiplica;
private String total;
sets and gets
}
tenho um método que cria uma lista
public void calcula() {
List lista = new LinkedList();
for(int i=0; i<5; i++) {
Valores v = new Valores();
v.setValor=1;
v.setMultiplica=2;
v.setTotal=v.getValor*v.getMultiplica;
}
}
Tenho um h:datatable com inputtexts referente ao Valor/Multiplica/Total.
Gostaria que minha h:datatable calculasse o Total assim que o valor do meu inputtext fosse alterado, então associei “valueChangeListener” com um método que atualiza o Total.
public void atualiza(ValueChangeEvent evt) {
for(int i=0; i<lista.size(); i++) {
Valores v = (Valores) lista.get(i);
v.setTotal=v.getValor*v.getMultiplica;
}
}
O problema é que sempre retorna o OldValue e não atualiza.
Alguém poderia me ajudar?