关于RedirectAttributes 重定向带参数请求问题

@PostMapping("/upate/{id}")
public String update(@PathVariable("id")Integer id,Category category,RedirectAttributes attributes) {
    int saveRes = categoryService.update(id,category);
    if (saveRes == 1) {//成功
        attributes.addFlashAttribute("msg", "恭喜,修改成功!");
    } else {//失败
        attributes.addFlashAttribute("msg", "恭喜,修改失败!");
    }
    return "redirect:/admin/category/list";  //重定向
}

@GetMapping("/list")
public String list(@ModelAttribute("msg") String msg,Model model) {
    PageBean<Category> categoryIPage = categoryService.listPage(pageNum, pageSize);
    if(msg == null) {
        model.addAttribute("msg", "恭喜,查询成功!");
    }
    model.addAttribute("data", categoryIPage);
    return "/admin/category";

 

上一篇:python – 如何使用LiveAPI发送剪辑名称(Ableton Live)


下一篇:RMAN同字节序跨平台跨版本迁移数据库(一)