介绍
官网:freemarker.org
数据模型=数据源+模板=html
一、静态资源加载
位置classpath 下的META-INF/resources、public、resources、static这四个包下
通过http://localhost:8080/jietua.png访问
简单整合freemarker
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
@Controller
public class FtlTest {
@RequestMapping("/name")
public String name(Map<String,Object> map){
map.put("name","灰猫");
map.put("age",26);
map.put("sex",0);
return "freemarker";
}
}
你就是个小白菜!!
名字:${name}
年龄:${age}
性别:<#if sex=0> 男 <#else > 女 </#if>