Sprintg Boot + thymeleaf传递数据

  • 后台传递数据

    • controller 层里的函数参数列表里添加(Model model) 参数
    • 在对应的 controller 函数里添加 model 变量的参数和参数值
    model.addAttribute("errorInfo","用户名或密码错误");
    
  • 前端html 页面使用数据

    
    

参考链接

[1] controller传递数据到thymeleaf的两种方式

[2] thymeleaf获取后台model值

[3] thymeleaf简易语法

你可能感兴趣的:(Sprintg Boot + thymeleaf传递数据)