In Spring Default the Dispatcher servlet will invoke the name of the servlet added xml

In Spring MVC if we declare like below

<servlet>
<servlet-name>helloweb</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloweb</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

When we send request from browser to Dispatcher servlet,defaultly dispatcher servlet will check for
/WEB-INF/helloweb-servlet.xml,to override this process we have to delcare like below

<servlet>
<servlet-name>helloweb</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/spring_mvc_config.xml
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>helloweb</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

Comments