I want to recuperatete data from database that depends on ID of the same table witch is recuperated by another function with some conditions;
here is my code , but it doesn't work ,i don't know how to solve it :(
@Override
public List<Float> findMontantByIdDetail(BigDecimal numCaisCais, int codDevDev)
{
System.out.println("Debut Fonction findMontantByIdDetail");
DetailCaisse detail=new DetailCaisse();
detail=findElementById( numCaisCais, codDevDev);
System.out.println(detail);
List<Float> montants=new ArrayList<Float>() ;
montants.add(detail.getMontToteDsc() );
montants.add(detail.getMontTotsDsc() );
System.out.println(montants.get(0) );
System.out.println(montants.get(1));
return montants;
}
page.xhtml
<h:outputText>Code Devise</h:outputText>
<p:inputText value="#{detailCtr.codDevDev}" />
<h:outputText>code Caisse</h:outputText>
<p:inputText value="#{detailCtr.numCaisCais}" />
<h:commandButton value="Submit" action="#{detailCtr.findMontant()}"
update="cc">
</h:commandButton>
<p:dataTable value="#{detailCtr.findMontant()}" var="detail"
style="width:50px" id="crsvente">
<p:column headerText="Montant total entrée" style="width:150px">
<h:outputText value="#{detailCtr.montants.get(0)}" id="cc" />
</p:column>
<p:column headerText="Montant total Sortie" style="width:150px">
<h:outputText value="#{detailCtr.montants.get(1)}" id="cc" />
</p:column>
the error is :
/pages/gestionCaisse/getMontant.xhtml @32,68 value="#{detailCtr.montants.get(0)}": java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
can you help me please :)