I have 2 arraylist filled on the java side : One with a full list of Nature : allNature
and another one with the selected one on the java side natures
. How can I check the natures
in the full allNatures
list ?
Here is my html code :
<div th:each="nature : ${allNature}" class="checkbox">
<label >
<input type="checkbox" th:field="*{natures}" th:value="${nature.nom}" class="checkboxNature" />
<span th:text="${nature.nom}">...</span>
<span th:text="${nature.routage.nomRoutage}" >...</span>
</label>
</div>
and the relevant (to me) java code in my controller :
@Controller
@SessionAttributes(value = "topologie", types = { Topologie.class })
@RequestMapping("/bus/topologie")
public class TopologieController {
@ModelAttribute("allNature")
public List<Nature> getAllNatures(final Topologie topologie)
throws Exception {
LOGGER.info("ModelAttribute to get all Nature for Cadre : {}",
topologie.getCadre());
return natureService.getNaturesByVersionCadre(topologie.getCadre(),
topologie.getVersionCadre());
}
and the object reference
public class Topologie {
private List<Nature> natures = new ArrayList<Nature>();
Aucun commentaire:
Enregistrer un commentaire