springmvc的搭建

2021-02-02 19:16

阅读:609

标签:依赖   value   控制器   jsp   font   cat   size   web   request   

引入依赖包


org.springframework
spring-webmvc
5.2.5.RELEASE




web.xml



dispatcherservlet
org.springframework.web.servlet.DispatcherServlet


contextConfigLocation

classpath:/configuration/SpringMvc.xml




dispatcherservlet
/



springmvc.xml

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
">



















Controller.java


//@Controller(功能和@Component一样;但他不仅注册了Bean并且将此类设置成了控制器);
@Controller
public class HelloHandler {
//映射请求地址
@RequestMapping("/index")
public String hello(){
System.out.println("index......");
//return一个页面名字,由视图解析器解析成物理路径;
return "index";
}
}

 

springmvc的搭建

标签:依赖   value   控制器   jsp   font   cat   size   web   request   

原文地址:https://www.cnblogs.com/loveweni/p/12807555.html


评论


亲,登录后才可以留言!