【发布时间】:2020-10-12 13:51:36
【问题描述】:
目前我的 Controller 是这样的。
@RequestMapping("成员")
公共类成员控制器 {
私有 ArrayList memberList = new ArrayList();
@GetMapping("")
公共字符串索引1(模型模型){
model.addAttribute(memberList);
返回“成员/成员索引”;
}
@GetMapping("索引")
公共字符串索引2(模型模型){
model.addAttribute(memberList);
返回“成员/成员索引”;
}
}
有没有一种更简单的方法可以为两个不同的路径“localhost:port/members”和“localhost:port/members/index”使用一个索引方法?一般来说,我可以为一种方法注释两个值吗?
提前致谢:)
编辑:我已经看到它适用于@RequestMapping
【问题讨论】:
标签: java spring spring-boot thymeleaf