Mastering Spring MVC

In this article I will be covering Spring MVC web framework. There are separated and different articles written regarding the framework. I will try to keep it simpler and more clear for you.

Spring MVC web framework is established on Model View Control web design patter which has been commonly and widely used in many of web applications. You may read the main architecture of MVC pattern here on wikipedia

When our web application has been launched, we expect and requests from the users, first of all entire request comes to the spring servlet called dispatcherServlet.xml which handles requests, moreover it does address and forward the upcoming user requests to controllers. The below schema explains us the further details of the inner architecture of spring web framework dispatcherServlet


(Image courtesy spring in practice)

To get started with the project first of all in our deployment configuration file web.xml, we need to add the required parameters for our project to meet spring framework and accept incoming user requests. The following web.xml should be like this:


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns:xsi=""
         id="WebApp_ID" version="2.5">






Hereby what we see with this configuration file is that we are defining our spring configuration to web.xml and showing spring configuration file. There is one important point here is that I named spring config file as mvc-dispatcher-servlet.xml. You may name it they way you want as long as it has been also defined in servlet file as well, but the last part has to ve XYZ-servlet.xml


<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="" xmlns:xsi=""
	xmlns:mvc="" xmlns:context=""

    <!-- Uncomment and your base-package here:
            base-package="org.springframework.samples.web"/>  -->

    <mvc:annotation-driven />

	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
	        <property name="prefix" value="/WEB-INF/view/"/>
	        <property name="suffix" value=".jsp"/>



Leave a Reply

Your email address will not be published. Required fields are marked *