1 pièce(s) jointe(s)
besion d'aide sur spring Boot
Bonjour, j'ai besoin d'aide, je ne parviens pas à receper une liste définie au niveau du contrôleur pour l’envoyer à ma vue jsp
voici mon contrôleur:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| @RequestMapping(value="/viewunusedrange",method=RequestMethod.GET)
public String viewunsedrangeStock(Model model,@RequestParam("stockID") int stockID,@RequestParam("language") String language,@RequestParam("category") String category,HttpServletRequest request){
List<SupplyBooklet> supplyBooklets=supplyBookletService.findByStockAndStatus(stockService.findById(stockID), "RECEIVED");
List<BookletPaquet> paquets=new ArrayList<BookletPaquet>();
for(int i=0;i<supplyBooklets.size();i++){
ArrayList<BookletPaquet> aux=new ArrayList<>();
aux.addAll(supplyBooklets.get(i).getBookletPaquet());
System.out.println(aux);
for(int j=0;j<aux.size();j++){
if(aux.get(j).getCategory().getName().equals(category)&&aux.get(j).getLanguage().equals(language)&&aux.get(j).getQuantity()>0)
paquets.add(aux.get(j)) ;
}
//paquets.addAll(supplyBooklets.get(i).getBookletPaquet());
}
// Créer unusedBooklets, comme copie de supplyBooklets
List<SupplyBooklet> unusedBooklets = new ArrayList<SupplyBooklet>(supplyBooklets);
// Enlever de unusedBooklets tout ce qui est dans paquets
unusedBooklets.removeAll(paquets);
model.addAttribute("unusedBooklets", unusedBooklets);
//model.addAttribute("paquets", paquets);
if(stockService.findById(stockID).getDrivingSchool()!=null)
model.addAttribute("drivingSchoolName",stockService.findById(stockID).getDrivingSchool().getName());
else model.addAttribute("drivingSchoolName","Presprint Plc : Unused range"
+ "");
return "stock/view_unusedrange_stock";
} |
voici la vue:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <thead>
<tr class="bg-primary">
<th>#</th>
<th><fmt:message key="start_range" /></th>
<th><strong><fmt:message key="end_range" /></strong></th>
<th><strong><fmt:message key="quantity_left" /></strong></th>
<th><strong><fmt:message key="category" /></strong></th>
<th><strong>Language</strong></th>
</tr>
</thead>
<tbody>
<c:set var="ligne" value="0" />
<c:set var="quantity" value="0" />
<c:forEach var="range" items="${unusedBooklets}">
<c:set var="ligne" value="${ligne + 1}" />
<c:set var="quantity" value="${quantity + range.quantity}" />
<tr align="left">
<td>${ligne}</td>
<td><c:out value="${range.startRange}" /></td>
<td><c:out value="${range.endRange}" /></td>
<td><c:out value="${range.quantity}" /></td>
<td><c:out value="${range.category.name}" /></td>
<td><c:out value="${range.language}" /></td>
</tr>
</c:forEach>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><strong>TOTAL</strong></td>
<td><strong>${quantity}</strong></td>
</tr>
</tbody> |
résultat :
Pièce jointe 464606