I can’t find correct client request flow in below syntax.Could someone please clarify what is happening here?
Client(1) --> Dispatcher Servlet(2) --> Handler Mapping(3) --> Controller(4) --> ModelAndView(5) --> viewResolver(6) --> View(7) --> Client(1)
If possible please specify what are the corresponding spring classes/interfaces used in spring MVC process.
Advertisement
Answer
- Request will be received by
DispatcherServlet
. DispatcherServlet
will take the help ofHandlerMapping
and get to know the@Controller
class name associated with the given request.- So request transfer to the
@Controller
, and then@Controller
will process the request by executing appropriate methods and returnsModelAndView
object (contains Model data and View name) back to the DispatcherServlet - Now
DispatcherServlet
send the model object to theViewResolver
to get the actual view page. - Finally,
DispatcherServlet
will pass the Model object to the View page to display the result.