程序员社区

Springmvc中@RequestMapping

一级目录

@Controller
public class ControllerTest {
    @RequestMapping("/t1")
    public String test1(Model model){
        model.addAttribute("msg","Controller");
        return "test";
    }
}

在这里插入图片描述

2.二级目录

@Controller
@RequestMapping("/c3")
public class RequestTest {
    @RequestMapping("/t1")
    public String testString(Model model){
        model.addAttribute("msg","requestMapping...");
        return "test";
    }
}

在这里插入图片描述
或者使用下面的方式:

@Controller
public class RequestTest {
    @RequestMapping("/c3/t1")
    public String testString(Model model){
        model.addAttribute("msg","requestMapping...");
        return "test";
    }
}

在这里插入图片描述

赞(0) 打赏
未经允许不得转载:IDEA激活码 » Springmvc中@RequestMapping

相关推荐

  • 暂无文章

一个分享Java & Python知识的社区