一、SpringMVC的HellowWord示例
非注解方式,根据beanname来查找Controller
(1)pom.xml文件配置
除了springmvc的依赖,由于用到了jstl,所以新增了jstl的依赖,用的是jetty启动项目
dependenciesdependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion4.11/versionscopetest/scope/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-webmvc/artifactIdversion5.1.4.RELEASE/version/dependency
dependencygroupIdjavax.servlet/groupIdartifactIdjavax.servlet-api/artifactIdversion4.0.1/versionscopeprovided/scope/dependencydependencygroupIdjavax.servlet/groupIdartifactIdjstl/artifactIdversion1.2/version/dependency/dependenciesbuildfinalNameSpringmvcDemo/finalNamepluginsplugingroupIdorg.eclipse.jetty/groupIdartifactIdjetty-maven-plugin/artifactIdversion9.4.3.v/version/plugin/plugins/build
(2)web.xml配置
servletservlet-namespringmvc/servlet-nameservlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-class/servletservlet-mappingservlet-namespringmvc/servlet-nameurl-pattern//url-pattern/servlet-mapping
(3)在web-info下面创建springmvc-servlet.xml文件,并把controll类注入spring容器
beanname=/hellclass=