第三章 SpringBoot 集成框架(二)

时间:2019-09-11 20:18:39   收藏:0   阅读:85
1、SpringBoot 默认能直接访问的静态资源目录:
 /static    public  /resources  /META-INF/resources
2、SpringBoot 集成 JSP :需要添加 JSP 的依赖 ,JSP 页面使用 JSTL 标签 。
3、SpringBoot 框架集成 JSP 时,打包的格式是war          打包:右键项目 --> Run as --> Maven build...    pom.xml中的打包方式:<packaging>war</packaging>
4、Freemarker 模板 
          模板的默认后缀为.ftl
                  布尔值
                  数字
                  字符串
                 日期类型
                 插值${...}
                 注释
                 FTL 标签
5、SpringBoot 集成 Freemarker 模版技术
1) 加入额外的 pom 依赖:
<!-- Spring Boot Freemarker 模板 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
2) 在 application.properties 配置 freemarker 配置或者使用默认模板位置/src/main/resources/templates/ 及
默认后缀.ftl。
## Freemarker 配置
## 自定义模板文件配置路径 默认模板路径在resources/templates下,默认后缀.ftl
##spring.freemarker.template-loader-path=classpath:/web/
##spring.freemarker.cache=false
##spring.freemarker.charset=UTF-8
##spring.freemarker.check-template-location=true
##spring.freemarker.content-type=text/html
##spring.freemarker.expose-request-attributes=true
##spring.freemarker.expose-session-attributes=true
##spring.freemarker.request-context-attribute=request
##spring.freemarker.suffix=.ftl
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!