springmvc的搭建
2021-02-02 19:16
标签:依赖 value 控制器 jsp font cat size web request springmvc的搭建 标签:依赖 value 控制器 jsp font cat size web request 原文地址:https://www.cnblogs.com/loveweni/p/12807555.html引入依赖包
spring-webmvc
web.xml
springmvc.xml
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";
}
}