Is there any way to accomplish something like this: I have a form used for navigation :
<form action="mapping.do">
<input type="submit" value="menuOption01" />
<input type="submit" value="menuOption02" />
</form>
The PageController
class is too big and has too many dependancies, I need to add another menu option but don't want to add to the complexity. I'd like to have a method in another controller which handles the new menu option.
Trying this gives me a Spring configutation error (There is already handler mapped):
@Controller
@SessionAttributes(types = { Entity.class })
class PageController {
@RequestMapping(params = "menuOption01", value = "mapping.do")
public String viewPage(@ModelAttribute final Entity entity) {
...
return "view";
}
... // another 5000 lines of code
}
@Controller
class OtherController {
@RequestMapping(params = "menuOption02", value = "mapping.do")
public String viewOtherPage(@ModelAttribute final Entity entity) {
...
return "otherview";
}
}