Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spring 3.0 MVC - Introduction By, Srinivas Reddy.S

Similar presentations

Presentation on theme: "Spring 3.0 MVC - Introduction By, Srinivas Reddy.S"— Presentation transcript:

1 Spring 3.0 MVC - Introduction By, Srinivas Reddy.S

2 Advantages of Spring 3.0 MVC Supports RESTful URLs. Annotation based configuration. Supports to plug with other MVC frameworks like Struts etc. Flexible in supporting different view types like JSP, velocity, XML, PDF etc.,

3 MVC – An overview Controller View Model Request Response

4 Front Controller

5 Front Controller - Responsiblities Initialize the framework to cater to the requests. Load the map of all the URLs and the components responsible to handle the request. Prepare the map for the views.

6 Spring 3 MVC- Basic Architecture Dispacther Servlet (Front controller) HandlerMapping (Map of URL and controllers) Controller (Responsible to handle request) View (JSP, XML, Velocity) Model (POJO) Request 1 5 4 3 2

7 Spring 3.0 MVC Request Flow DispatcherServlet Capture the Request Locale If request is multipart- File upload data is exposed HandlerMapping (Map of URL and controllers) Handler Chain Interceptor - Pre Process Interceptor - Pre Process Controller Interceptor - Post Process Interceptor - Post Process View Resolver Prepare the View Request Response

8 Spring 3 MVC Framework- Initialization Dispatcher Servlet - Initialization MultipartResolver LocaleResolver ThemeResolver HandlerMappings HandlerAdapters HandlerExceptionResolvers RequestToViewNameTranslator ViewResolvers

9 Important Intefaces InterfaceDefault bean namepurpose org.springframework.web.servlet. HandlerMapping handlerMappingMaps the Request to Handlers(Controllers) org.springframework.web.servlet. HandlerAdapter nonePlugs the other frameworks handlers org.springframework.web.servlet. ViewResolver viewResolverMaps the view names to view instances org.springframework.web.servlet. HandlerExceptionResolver handlerExceptionRes olver Mapping of the exceptions to handlers and views org.springframework.web.multip art. MultipartResolver multipartResolverInterface to handle the file uploads org.springframework.web.servlet. LocaleResolver localeResolverHelps to resolve the locale from the request org.springframework.web.servlet. ThemeResolver themeResolverResolves a theme for a Request.

10 Spring 3.0 MVC Configuration Step 1: – Configure the web.xml with DispatcherServlet and details of the application context file location. spring3 org.springframework.web.servlet.DispatcherServlet 1 spring3 *.*

11 Spring 3.0 MVC Configuration Step 2: – Configure the contextConfigLocation for the application context to be loaded contextConfigLocation /WEB-INF/spring3-service.xml org.springframework.web.context.ContextLoaderListener

12 Spring 3.0 MVC Configuration Step 3: Configure the spring3-servlet.xml <beans xmlns="" xmlns:xsi="" xmlns:context="" xsi:schemaLocation=""> <context:component-scan base-package="com.java9s.web" /> <bean class="org.springframework.web.servlet.mvc.annotation. DefaultAnnotationHandlerMapping" /> <bean class="org.springframework.web.servlet.mvc.annotation. AnnotationMethodHandlerAdapter" />

13 Thank you visit

Download ppt "Spring 3.0 MVC - Introduction By, Srinivas Reddy.S"

Similar presentations

Ads by Google