springboot整合freemarker七

1、配置freemrker静态资源,所有模板、页面文件都存放在resources下的templates下

springboot整合freemarker七_第1张图片

2、freemarker模板是以.ftl为后缀结尾的文件,模板文件

springboot整合freemarker七_第2张图片

3、调用模板文件

springboot整合freemarker七_第3张图片

在启动程序时,如果在页面出现的是字符串而非渲染的页面,回到pom.xml文件查看是否添加了freemarker

                
			org.springframework.boot
			spring-boot-starter-freemarker
			RELEASE
		

启动项目

springboot整合freemarker七_第4张图片

渲染成功


你可能感兴趣的:(SpringBoot)