Hi,
I have a controller to show a jsp page:
In that view, "nodoak" I've got a form with a submit button. And another controller for the form:Code:@Controller public class NodoController { @RequestMapping(value="nodoak.htm") public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { NodoManager nodoManager = new NodoManager(); List<Nodo> nodoLista = nodoManager.getNodoList(); Nodo nodo = nodoLista.get(0); ModelAndView modelAndView = new ModelAndView("nodoak"); modelAndView.addObject("nodo", nodo); return modelAndView; } }
It doesn't work and I'm getting this error:Code:@Controller @SessionAttributes public class FormController { @RequestMapping(value="/nodoak.htm", method=RequestMethod.POST) public ModelAndView onSubmit(FormObject formObject, BindingResult result){ ModelAndView modelAndView= new ModelAndView("nodoak"); Nodo nodo = new Nodo(); NodoManager nodoManager= new NodoManager(); nodo=nodoManager.getNodoList().get(formObject.getId()); modelAndView.addObject(nodo); return modelAndView; } }
java.lang.IllegalStateException: Cannot map handler [nodoController] to URL path [/nodoak.htm]: There is already handler [com.kbp.sim.web.NodoController@18bddf0] mapped.
What's happening, I am telling Spring to use two controllers for the same page? How can I do what I'm trying to do? A controller to show the page comming from a link, and another controller to control the form. And that controller has to send me to the same page, but with another model.
Help please! I hope I've been clear.


Reply With Quote
