springMVC--注解配置
web.xml配置
SpringMVC
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc-servlet.xml
1
SpringMVC
/
绑定springmvc配置文件
controller层
package com.kuang.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
- @author Administrator
- @description: TODO
- @date 2021/11/20 9:58
*/
//表明这个是控制器
@Controller
public class HelloController {
//访问jsp的路径
@RequestMapping("/hello")
public String test(Model model){
model.addAttribute("msg","helloSpringMvcAnnotation");
//返回哪个页面
return "hello";//视图解析
}