Sequence:
1)在SpringMVC中,DispatcherServlet作为前端控制器来负责接收用户通过浏览器发送的一个请求。
2)然后DispatcherServlet开始查询一个或多个HandlerMapping(记录了mapping between controller object and url
3)DispatcherServlet delegate the request to the correspondent Controller in which actually delegate to business Object.
4)After business method return, a ModelAndView return to DispatcherServlet by Controller.
5)If the ModelAndView take only a logic name for the view object, DispatcherServlet have to ask for help of ViewResolver to query the View Object which server as rendering the response.
6) View Object responsible for render the response return to client.
Configuration:
1)configurate DispatcherServlet in web.xml
In order to seperate the different tier context file, we must configurate listener and context-params in web.xml
NOTE:contextConfigLocation is a comma sepeartion.
Creating Main Page.
Step
1. code Controller class.
2. configurate traning-servlet.xml (DispatcherServlet context configuration file)
3.Code ViewResolver to combine the Controller and JSP
4. Code JSP
1)Controller is analogous to action.
Code a Controller is much like code a action-extends Controller, override the handleRequest(httprequest,httpresponse),return a ModelAndView
2)configurate the Controller.
The name property in bean element confuse the novice just like me.
It have two meaning, define the bean name and url pattern of this Controller.
3)define a ViewRevoler
4)create JSP (omit the details)