Beruflich Dokumente
Kultur Dokumente
0 MVC Introduction
www.JAVA9S.co
By, Srinivas
Supports RESTful URLs. Annotation based configuration. Supports to plug with other MVC frameworks like Struts etc. Flexible in supporting different view types like www.JAVA9S.co JSP, velocity, XML, PDF
MVC An overview
Model
Request
Controller
Response
www.JAVA9S.co
View
Front Controller
Front Controller
www.JAVA9S.co
www.JAVA9S.co
Controller
(Responsible to handle request)
www.JAVA9S.co
Request
Handle rChain
ViewResolvers
Interface
Default bean purpose name org.springframework. handlerMappingMaps the Request web.servlet.HandlerMa to pping Handlers(Controller s) org.springframework. none Plugs the other web.servlet.HandlerAd frameworks apter handlers org.springframework. viewResolver Maps the view web.servlet.ViewResol names to view ver instances org.springframework. handlerExceptioMapping of the web.servlet.HandlerExce nResolver exceptions to ptionResolver handlers and views
Important Intefaces
Step 1:
Configure the web.xml with DispatcherServlet and details of the application context file location.
<servlet> <servlet-name>spring3</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring3</servlet-name> <url-pattern>*.*</url-pattern> </servlet-mapping>
www.JAVA9S.co
www.JAVA9S.co m
www.JAVA9S.co