Find the total to pay using displayTag in Java Web

0

Good afternoon.

I have this.

My query is that I want to find the total to pay, obviously the logic is to add all the subtotals there are, but that total to pay would like to be increased as one:

       <display:column/>

For the SubTotal I'm using Wrapper:

       public String getSubtotal(){

        ReservaDTO r = (ReservaDTO) getCurrentRowObject();

        double pre = r.getPrecio();
        int cant = r.getCant();


        return (pre*cant)+ " Soles";
}

From this displayTag comes what is in the first image:

Thanks in advance.

    
asked by Jorge Requez 16.06.2016 в 21:07
source

1 answer

0

You can use <display:footer> at the end of your <display:column to add a row at the bottom of the table showing the summary information.

<display:table ... >
    <display:footer>
        <td colspan="3">Total:</td>
        <td><c:out value="${totalReserva}" /></td>
        <td></td>
    </display:footer>
</display:table>

Where the value of totalReserva you calculate before rendering your page.

    
answered by 18.06.2016 в 21:04