From the example on spring official site, I conclude the flow of Spring's MVC.

1. Request --> org.springframework.web.servlet.DispatcherServlet --> parse [ServletName]-servlet.xml --> dispatch to Controller
    The “Request” is the “url-patten” mapped in web.xml of web application.
    [ServletName] is the name DispatcherServlet mapped (you can also extend it).

2.  Create your own Controller “MyController“ --> implement Interface org.springframework.mvc.Controller  --> write code of  controlling in method handleRequest() which inherited from “Controller” -->  return the created model and view obejcts of org.springframework.mvc.ModelAndView --> the framework will render it automatically
    The constructor of ModelAndView takes 1 or 3 parameter(s). 

    For 3 parameters, first one is the view path (The truth path or resolved path. The resolved path is resolved by org.springframework.web.sevrlet.view.InternalResourceViewResolver. I will explain it when I post the next time.). 
    The second one is the model object's given name, it's String. This name is NOT the object's variant-name. This name will be used in jsp. You can look it as an alias.
    The third one is the model object ( just the variant you will pass to jsp view ).

3. Ok, Use the returned model object in jsp.

I am an beginner of Java, so i can not conclude if the flow is the common MVC flow.

to be continue ...

相关文章:

  • 2021-08-06
  • 2021-12-04
  • 2022-12-23
  • 2021-06-29
  • 2021-08-18
  • 2021-05-25
猜你喜欢
  • 2021-10-15
  • 2021-05-18
  • 2022-12-23
  • 2021-11-10
  • 2022-02-18
  • 2021-12-14
  • 2021-11-19
相关资源
相似解决方案