Bonjour à tous,
Je réalise un petit formulaire afin d'apprendre Spring MVC mais j'ai cette erreur:
Voici mon controlleur:GRAVE: "Servlet.service()" pour la servlet jsp a g�n�r� une exception
javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean name 'participant' available as request attribute
at org.springframework.web.servlet.tags.BindTag.doStartTagInternal(BindTag.java:120)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
at org.apache.jsp.inscription_jsp._jspService(inscription_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
applicatinContext.xml:
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
21 public class HelloController extends SimpleFormController { private HelloService helloService; private ImplParticipantDao implParticipantDao; ...getter et setter... public HelloController() { setCommandClass(Participant.class); //Class setCommandName("participant"); //Nom du champs ! setSuccessView("encours"); // En cas de succes,l'action du formulaire ! setFormView("inscription"); //Nom de mon fichier ! } @Override protected ModelAndView onSubmit(Object command) throws Exception{ Participant participant =(Participant)command; ModelAndView mv = new ModelAndView(getSuccessView()); implParticipantDao.addParticipant(participant); mv.addObject("participant", helloService.addParticipant()); return mv; } }
dispatcher-servlet.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 ... <!-- Les classe metiers --> <bean name="helloService" class="be.appl.metier.HelloService" /> <bean name="implParticipantDao" class="be.appl.concours.dao.ImplParticipantDao" /> ...
Je n'arrive même pas à accéder à mon formulaire JSP que voici:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 ...<bean class="be.appl.controller.HelloController"> <property name="helloService" ref="helloService"/> <property name="implParticipantDao" ref="implParticipantDao"/> </bean>...
Avez vous une idée ?
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 <h2>Inscription</h2> <spring:nestedPath path="participant"> <table width="600px" border="0"> <form action="" method="post"> <tr> <td width="300px">Name:</td> <spring:bind path="participant.nom"> <td><input type="text" name="${status.expression}" value="${status.value}" ></td> </spring:bind><br> </tr> <tr> <td>Prénom:</td> <spring:bind path="participant.prenom"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr> <tr> <td>Login:</td> <spring:bind path="participant.login"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr> <tr> <td>Mots de passe:</td> <spring:bind path="participant.mp"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr> <tr> <td>Confirmer le mots de passse:</td> <spring:bind path="participant.mp"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr> <tr> <td>Mail:</td> <spring:bind path="participant.mail"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr> <tr> <td>Numéro du bureau:</td> <spring:bind path="participant.bureau"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr> <tr> <td>Téléphone bureau:</td> <spring:bind path="participant.telephone"> <td><input type="text" name="${status.expression}" value="${status.value}"></td> </spring:bind> </tr><p></p> <tr> <td></td> <td> <input type="submit" value="Enregistrer"><input type="reset" value="Annuler"> </td> </tr> </form> </table> </spring:nestedPath>
D'avance merci à tous
Partager