微服务,微架构[十]springboot模板页面freemarker
来源:互联网 发布:suse 端口开放 编辑:程序博客网 时间:2024/06/08 23:01
springboot可以集成很多模板文件来实现访问页面,今天我们主要介绍freemarker的集成方式
一、freemarker 依赖jar文件pom.xml配置添加
<dependency>
<groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
二、创建页面文件,默认读取路径templates,扩展名为index.ftl
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" /> <title></title></head><body>FreeMarker模板引擎<h1>${host}</h1></body></html>
三、访问控制器返回页面内容
/**** @author e生态* @version 1.0.0* @blog http://blog.csdn.net/ysl_228**/@Controllerpublic class HelloController { @RequestMapping("/hello") @ResponseBody public String hello() { return "Hello World"; } @RequestMapping("/") public String index(Model map) { map.addAttribute("host", "http://blog.csdn.net/ysl_228"); return "index"; }}
集成很简单,感谢大家的阅读本文
阅读全文
0 0
- 微服务,微架构[十]springboot模板页面freemarker
- 微服务,微架构[十一]springboot模板页面velocity
- 微服务,微架构[十一]springboot模板页面thymeleaf
- SpringBoot开始微服务架构
- 微服务,微架构[一]之springboot[helloWorld]
- 微服务,微架构[二]之springboot集成jdbc
- 微服务,微架构[四]之springboot集成Redis缓存
- 微服务,微架构[五]之springboot读取properties文件
- 微服务,微架构[六]之springboot集成mybatis
- 微服务,微架构[零]springboot入门介绍
- 微服务,微架构[七]之springboot异常处理
- 微服务,微架构[八]springboot多环境切换profiles
- 微服务,微架构[十二]springboot监听器,过滤器
- 微服务,微架构[十三]springboot集成RabbitMQ
- SpringBoot快速构建微服务架构体系
- 基于SpringBoot的微服务架构实践
- 微服务架构(十): 一些别的问题
- SpringBoot添加freemarker模板引擎
- git
- 深入理解死锁
- android使用SVG
- eclipse中SSH动态web项目目录结构
- windows安装Caffe 问题收集与解决
- 微服务,微架构[十]springboot模板页面freemarker
- 医院“移动”不起来软肋在数据安全?
- BZOJ 2669: [cqoi2012]局部极小值
- 一个简单的学生管理系统
- 学习笔记|AS入门(番外) 技能篇
- SSH三大框架整合
- 2017PHP学习路线图
- MYSQL和ORACLE的一些区别
- [BZOJ]1016: [JSOI2008]最小生成树计数