Preparation conditions:
STS (Eclipse with spring-related tools integrated)
Steps:
Add the jar package.
Create a new Dynamic Web project in Eclipse. Select Tomcat 7.0 and add the following jar packages under the Webcontent-->web-inf-->lib directory.
Spring-aop-4.3.3.release.jar
Spring-beans-4.3.3.release.jar
Spring-context-4.3.3.release.jar
Spring-core-4.3.3.release.jar
Spring-expression-4.3.3.release.jar
Spring-web-4.3.3.release.jar
Spring-webmvc-4.3.3.release.jar
Additional Commons-logging-1.2.jar files are also required.
Add Dispatcherservlet related content in Web. XML (using the shortcut key alt+/, in the pop-up drop-down bar, select #dispatcherservlet). The contents of the Web. XML configuration file can refer to the following: <?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "http:/ /www.w3.org/2001/xmlschema-instance " xmlns=" Http://java.sun.com/xml/ns/javaee " xsi:schemalocation=" Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd " version=" 3.0 " > <display-name>HelloWorld</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file >index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> < welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</ Welcome-file> </welcome-file-list> <!-- the front controller of this spring web application, responsible for handling all application requests --><servlet> <servlet-name>springDispatcherServlet</servlet-name><servlet-class> org.springframework.web.servlet.dispatcherservlet</servlet-class><!-- Configure an initialization parameter for the Dispathcerservlet, set the name and location of the configuration file --><init-param><param-name>contextconfiglocation </param-name><param-value>classpath:springmvc.xml</param-value></init-param>< load-on-startup>1</load-on-startup></servlet><!-- map all requests to the DispatcherServlet for handling --><servlet-mapping><servlet-name> Springdispatcherservlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping> </web-app> Add springmvc config file. Write the requested processor. Write a view.
Springmvc (b): HelloWorld