springboot中如何使用freemarker-入门

2024-10-30 08:17:31

1、首先在pom.xml中引入spring-boot-starter-freemarker依赖。

springboot中如何使用freemarker-入门

3、然后在resources/templates目录下建index.ftl文件,这里只能用ftl后缀,这是freemarker默认后缀。

springboot中如何使用freemarker-入门

5、启动项目,访问localhost:8080,可以看到,后台返回的参数已经成功展示到前台页面。

springboot中如何使用freemarker-入门

7、修改index.ftl文件,如下:

springboot中如何使用freemarker-入门
猜你喜欢