Knowledge Walls
Java Master
Hyderabad, Andhra Pradesh, India
What is a front controller in Spring MVC in Define of Core Java
10045 Views
DispatcherServlet 
A front controller is defined as “a controller which handles all requests for a Web Application.” DispatcherServlet (actually a servlet) is the front controller in Spring MVC that intercepts every request and then dispatches/forwards requests to an appropriate controller.
Web.xml with DispatcherServlet
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>
Hints 
org.springframework.web.servlet.DispatcherServlet class used to controls the request and response with given url pattern. *.htm. Application context bean and wiring bean xml file has to create with the -servlet.xml suffix. So that for above example dispatcher-servlet.xml is the name of the application context xml file.
Next
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details