User Manual

<servlet-mapping>
<servlet-name>EmpInfo</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
NOTE: This servlet definition maps to the application patterns. Any URL with the .htm
extension is routed to the EmpInfo servlet (the DispatcherServlet).
After modification, the web.xml file appears as:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
EmpInfo</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>EmpInfo</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>EmpInfo</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
</web-app>
Creating the EmpInfo-servlet.xml File
Create a WebApplicationContext file, which contains references to all the web-related
components. The name of this file is determined by the value of the <servlet-name/> element
in the web.xml file, with -servlet appended to it (hence, EmpInfo-servlet.xml). This is
the standard naming convention used with the Spring Web MVC framework.
The EmpInfo-servlet.xml file contains the bean definitions (plain Java objects) used by the
DispatcherServlet.
To create the EmpInfo-servlet.xml file in the EmpInfo/WebContent/WEB-INF directory:
1. In the Project Explorer frame, right-click EmpInfo and select New > Other.
The New File Wizard dialog box appears.
48 Spring Framework