mardi 27 août 2019

nested for loop in html table with thymeleaf

I am trying to create a table that is created from Lists of different sizes. I have a list of Cars List<Car>. So in the header i want to place the names of the different companies which i did.

then i have a List<List<CarSales>> and not all Cars exist in each carSales. So i want to iterate through the List of List of each tr (also ok) and then i want to iterate in the td though the List and place the CarSales.sales in the correct td where CarSales.mark=Car.makr of the header.

So if List<Cars> is (i mean Cars.mark)

[BMW, MERCEDES,FIAT]

and List<List<CarSales>> is (i mean object that have mark and sales inside)

[[BMW:5,FIAT:10],[MERCEDES:12]]

I want a table with:

BMW - MERCEDES - FIAT

5 - 0 - 10

0 - 12 - 0




Aucun commentaire:

Enregistrer un commentaire