Spring MVC

MVC defines the following special beans:

  • DispatcherServlet – A servlet (web.xml) that takes an incoming request and hands it off to a Handler Mapping defined in its configuration (xxx-servlet, or other if using contextConfigLocation param). (link)
  • Controllers – handles an incoming request
    • @Controller – Custom controllers defined using annotations
    • FlowController – handles Web Flow requests
  • Handler Mappings – Maps incoming requests to controllers
    • SimpleUrlHandlerMapping – explicit mappings using key & value pairs (link)
      <prop key="/welcome.htm">welcomeController</prop> # option 1
      <value>/welcome.htm=welcomeController</value> # option 2
    • RequestMappingHandlerMapping– looks for @RequestMapping annotations on all @Controller beans
    • BeanNameUrlHandlerMapping – maps HTTP requests to names of beans defined in web application context
  • View Resolvers – resolves logical names (strings) to actual views ( ViewResolver is an interface)
    • UrlBasedViewResolver – resolves views using its URL
    • InternalResourceViewResolver – subclasses UrlBasedViewResolver. Use this to handle Servlets / JSPs, can handle forwards / includes.
    • VelocityViewResolver– Apache Velocity templates
    • FreeMarkerViewResolver – Free Marker templates
    • FlowViewResolver – resolves views for Web Flow


Posted in Spring, Spring MVC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: