Answer the question
In order to leave comments, you need to log in
How are many forms handled in one controller (Spring)?
Imagine a situation, there is a page and it has 5 forms and it is processed by one controller. How to handle 5 forms in this controller?
Of course, we can do this, but I have doubts about the literacy of this approach!?
@RequestMapping(value = "/main", method = RequestMethod.POST)
public String process(@ModelAttribute("one") One one, @ModelAttribute("two") Two two, @ModelAttribute("three") Three three, @ModelAttribute("Four") Four four, @ModelAttribute("Five") Five five) {
.... Тут обрабатываем.... а чти если пришла одна форма!? пользоваться if else ?!
}
Answer the question
In order to leave comments, you need to log in
I think this should help https://stackoverflow.com/a/7104977/8498513
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question