Jan 3rd, 2006, 04:35 PM
How to redirect to next controller ?
All of the spring books I have seen, I always see that the controller action always returns a ModelAndView reference to a new Jsp page. Meaning see following example:--
return new ModelAndView(getSuccessView(),"accountdetail",acco untdetail); This will display the accountdetail.jsp page. I do not want this to happen.
What if at the end, I want to redirect the control to onSubmit method of new controller.
In short how do i redirect the control from controller1.onSubmit to controller2.onSubmit ?
Jan 4th, 2006, 12:42 AM
There is no explicit configuration for controller chaining in Spring MVC.
If you are trying to do a HTTP redirect, then it's pretty easy, as you can just do: new ModelAndView("redirect:/some/uri") or create an instance of a RedirectView.
You can, however, simply use Dependency Injection to get controller2 into controller1, and call controller2.onSubmit() youself.