Bonjour à tous,
Je suis débutante en Spring MVC , et pour commencer j'ai décidé de suivre le tutoriel suivant : http://netbeans.org/kb/68/web/quicks...ps-spring.html
mais voilà quand j'arrive au petit 9 du tutoriel , j'ai l'erreur suivant qui apparait dans mon code a cote de mon override situé juste avant la méthode onSubmit .
alors qu'il est précisé selon le tutoriel All errors should now be fixed.method does not override or implement a method from a supertype
onSubmit(java.lang.Object) in controller.NewSimpleFormController cannot override onSubmit(java.lang.Object) in org.springframework.web.servlet.mvc.SimpleFormController
return type org.springframework.web.portlet.ModelAndView is not compatible with org.springframework.web.servlet.ModelAndView
voici mon code
étant totalement novice , je n'arrive pas à comprendre le pourquoi de cette erreur
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 /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package controller; import org.springframework.web.portlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import service.HelloService; /** * * @author bordelaisj */ public class NewSimpleFormController extends SimpleFormController { private HelloService helloService; public void setHelloService(HelloService helloService) { this.helloService = helloService; } public NewSimpleFormController() { //Initialize controller properties here or //in the Web Application Context setCommandClass(Name.class); setCommandName("name"); setSuccessView("helloView"); setFormView("nameView"); } /*@Override protected void doSubmitAction(Object command) throws Exception { throw new UnsupportedOperationException("Not yet implemented"); }*/ //Use onSubmit instead of doSubmitAction //when you need access to the Request, Response, or BindException objects @Override protected ModelAndView onSubmit(Object command) throws Exception { Name name = (Name) command; ModelAndView mv = new ModelAndView(getSuccessView()); mv.addObject("helloMessage", helloService.sayHello(name.getValue())); return mv; } }
Je m'adresse donc à vous ,
Merci d'avance
Kniz'
Partager