- Prgrammer deploys the spring web MVC application to the web-server or Application Server.
- Deployment actions takes place on the DispatcherServlet & its supplied IOC container.
- Then browser gives request by having url.
- As FrontController configured with url-pattern as directory match or extension match, it will traps and takes the request and applies common system services.
- Then it hand overs the request to the Handler mapping component, and Handler mapping component will maps that rquest URI to the specific Handler class.
- And return the bean id of Handler class to DispatcherServlet.
- Then the DispatcherServlet managed IOC container will call the getBean() method and gets Handler class object.
- Then DispatcherServlet calls Handler class method on Handler class object, and delegates the request to Handler class.
- If request from form page(having request params) then Handler class internally writes the form data to the command class object(a kind of Java bean).
- Handler class either directly process the rquest or passes the request to the service for request processing and keeps the generated result/output and Logical view name in ModelAndView class object.
- Then method of Handler class returns MAV(ModelAndView) object to DispatcherServlet.
- After receiving MAV object DispatcherServlet collects results from MAV object and keeps in request scope and then collects logicalview name for passing to ViewResolver component.
- Then DispatcherServlet passes the (logical view name) to ViewResolver.
- ViewResolver resolves the name, location and technology of View Resource like jsp page and returns view object having physical view name & location to DispatcherServlet.
- After receiving view object from ViewResolver, DispatcherServlet calls render() method on it.
- After calling the render() method on view object, it transfers the control to Physical view resource component like(jsp, html pages).
- Physical view Resource collects results data from request scope and formats it to send to browser as response.
- Browser receives the response and displays it as web page.
Home »
» Spring Web MVC flow
No comments:
Post a Comment