Bonjour,
J'essaye de créer et de gérer un formulaire avec Spring MVC, mais je suis bloqué par l'erreur : Neither BindingResult nor plain target object for bean name
mon code est comme suit :
ma page JSP
mon Controller :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <form:form action="res-reg-cpt-fav-validate.html" methd="POST" commandName="compteFavoriDTO"> <form:label path="idPrestation"> <spring:message code="label.idPrestation"></spring:message> </form:label> <form:label path="libellePerso"> <spring:message code="label.libellePerso"></spring:message> </form:label> <form:label path="borneMin"> <spring:message code="label.borneMin"></spring:message> </form:label> <form:label path="borneMax"> <spring:message code="label.borneMax"></spring:message> </form:label> </form:form>
j'arrive pas à voir l'origine du problème.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 @Controller @RequestMapping("mob/res-reg-cpt-fav-validate.html") public class EnrRegComptesController { @RequestMapping(method=RequestMethod.GET) public String showForm(Model model) { model.addAttribute("compteFavoriDTO", new CompteFavoriDTO()); return "compteFavoriDTO"; } @RequestMapping(method = RequestMethod.POST) public String addContact(@ModelAttribute("compteFavoriDTO") CompteFavoriDTO compteFavoriDTO, BindingResult result) { System.out.println("je suis bien dans la méthode POST"); return "OK"; }
Merci pour votre aide.
Partager