美文网首页
thymeleaf模板的使用

thymeleaf模板的使用

作者: 黑子_f338 | 来源:发表于2018-09-07 17:29 被阅读0次
thymeleaf

什么是thymeleaf模板

Thymeleaf是一个用于服务器端的java模板引擎,它使用简单但功能强大,目前可以处理的模板类型包括:HTML、XML、TEXT、JavaScript、CSS等。

为什么要使用thymeleaf模板

一:thymeleaf原型即页面(会用的情况下)

二:基于HTML开发

在这之前怎么做的?

在这之前我们要写四个层面,dao,service,controller,api。四个层面层层递进,每个层面测通了才能往下进行,然后给前端调用。

该怎么用?

 添加pom依赖

代码结构目录

* 编写controller层

@Controller //模板开发

public class IndexController {

//注入一个Student类的对象。被Spring容器托管--bean

    @Resource

    private Studentstudent;

//@RequestMapping(value = "/index",method = RequestMethod.GET)

    @GetMapping("/index")

public String index(ModelMap map){

student.setStudentNo("2018");

student.setName("徐江");

student.setMale("nan");

student.setAge(20);

map.addAttribute("student",student);

//        map.put("student",student);//将模型数据加入视图

        return "index";//返回的页面名字

    }

}

前端调用

相关文章

  • SpringBoot 之Thymeleaf模板

    阅读目录 一、前言 二、集成Thymeleaf 模板引擎 三、使用 Thymeleaf 模板 回到顶部 一、前言 ...

  • SpringBoot-05-之上传文件

    需要使用引擎模板thymeleaf,如果不清楚,可见04--SpringBoot之模板引擎--thymeleaf ...

  • Spring boot入门Controller

    缺少了模板的渲染,springboot支持的模板如下: Thymeleaf模板的使用:(使用官方推荐的这个模板,先...

  • thymeleaf模板的使用

    什么是thymeleaf模板 Thymeleaf是一个用于服务器端的java模板引擎,它使用简单但功能强大,目前可...

  • thymeleaf学习日志

    thymeleaf介绍 Thymeleaf模板Spring boot 官方推荐使用来代替jsp,是一款用于渲染XM...

  • thymeleaf 模板使用

    1.导入依赖 2.配置模板,开发一般关闭模板缓存 3.编写模板 *.html 文件,位于 templates 路径...

  • 微架构 springcloud-03. springboot-使

    使用 jsp 和 servlet 前面已经说到,springboot 默认推荐使用thymeleaf模板引擎,那么...

  • Thymeleaf模板的使用

    因为个人偏爱Rest接口的编程,所以比较排斥这类模板,不过客观地讲模板还是有他自己的一些优势的,Spring Bo...

  • Thymeleaf 模板的使用

    Thymeleaf 是现代化服务器端的Java模板引擎,不同与JSP和FreeMarker,Thymeleaf的语...

  • SpringBoot & Thymeleaf项目实战

    web模板语言-thymeleaf thymeleaf[https://www.thymeleaf.org/] 项...

网友评论

      本文标题:thymeleaf模板的使用

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