美文网首页
Sprintg Boot + thymeleaf传递数据

Sprintg Boot + thymeleaf传递数据

作者: Aurochsy | 来源:发表于2019-07-17 22:52 被阅读0次
  • 后台传递数据

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

    <span th:text="${errorInfo}"></span>
    

参考链接

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

[2] thymeleaf获取后台model值

[3] thymeleaf简易语法

相关文章

网友评论

      本文标题:Sprintg Boot + thymeleaf传递数据

      本文链接:https://www.haomeiwen.com/subject/icjhlctx.html