Spring boot +Thymeleaf 搭建springweb
对接天猫精灵的时候需要有网关服务器方提供几个页面,服务器已经有了,spring boot的 纯后台的,就加了Thymeleaf jar包添加几个页面跳转
maven配置
- <!-- 引入thymeleaf模板引擎-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-thymeleaf</artifactId>
- </dependency>
- </dependencies>
yml配置
- spring:
- profiles: shypro
- thymeleaf:
- prefix: classpath:/templates/
- suffix: .html
- mode: LEGACYHTML5
- encoding: UTF-8
- content-type: text/html
- cache: false
在resource下新建templates目录
controller的注解是@Controller,return的string是html的文件名
- @Controller
- public class HtmlController {
- @RequestMapping("/testhtml")
- public String index(){
- System.out.println("index");
- return "index";
- }
- }
html的数据渲染看如下博客
https://www.jianshu.com/p/23bea93e34c7
https://www.jianshu.com/p/a842e5b5012e
Thymeleaf 的语法大全
https://www.cnblogs.com/ityouknow/p/5833560.html
Spring boot +Thymeleaf 搭建springweb的更多相关文章
- spring boot + thymeleaf 3 国际化
在给spring boot 1.5.6 + thymeleaf 3进行国际化时,踩了一个坑(其实不止一个). 现象: 看到了吧, 就是取值的key, 后面被加了_en_US 或 _zh_CN, 以及前 ...
- spring boot + Thymeleaf开发web项目
"Spring boot非常适合Web应用程序开发.您可以轻松创建自包含的HTTP应用.web服务器采用嵌入式Tomcat,或者Jetty等.大多数情况下Web应用程序将使用 spring- ...
- Spring Boot+CXF搭建WebService(转)
概述 最近项目用到在Spring boot下搭建WebService服务,对Java语言下的WebService了解甚少,而今抽个时间查阅资料整理下Spring Boot结合CXF打架WebServi ...
- Spring boot+Thymeleaf+easyui集成:js创建组件页面报错
开发工具:Ideal 使用场景:Demo 前提: 环境:Spring boot +Thymeleaf+easyui 引入thymeleaf模板引擎 <html lang=" ...
- spring boot: thymeleaf模板引擎使用
spring boot: thymeleaf模板引擎使用 在pom.xml加入thymeleaf模板依赖 <!-- 添加thymeleaf的依赖 --> <dependency> ...
- Spring Boot 项目学习 (三) Spring Boot + Redis 搭建
0 引言 本文主要介绍 Spring Boot 中 Redis 的配置和基本使用. 1 配置 Redis 1. 修改pom.xml,添加Redis依赖 <!-- Spring Boot Redi ...
- Spring Boot Thymeleaf 实现国际化
开发传统Java WEB工程时,我们可以使用JSP页面模板语言,但是在SpringBoot中已经不推荐使用了.SpringBoot支持如下页面模板语言 Thymeleaf FreeMarker Vel ...
- spring boot + thymeleaf 乱码问题
spring boot + thymeleaf 乱码问题 hellotrms 发布于 2017/01/17 15:27 阅读 1K+ 收藏 0 答案 1 开发四年只会写业务代码,分布式高并发都不会还做 ...
- Spring boot项目搭建及简单实例
Spring boot项目搭建 Spring Boot 概述 Build Anything with Spring Boot:Spring Boot is the starting point for ...
随机推荐
- 推荐一看的blog
不同专题: 个人blog cnblogs.com/MiLog cnblogs.com/Dway (指DeepWay) cnblogs.com/muly 建议一看,主要发布在cnblogs.com/dl ...
- (趣味哈哈镜)JMF中摄像头相关的问题
JMF已经非常古老了.最近由于做实验的需要,不得不使用JMF处理视频.开发使用win10系统和eclipse.使用中的问题如下: 1.首先想要使用JMF需要必须安装32位JDK,同时编译软件也需要是3 ...
- golang方法
1.方法声明 在函数声明时,在其名字之前放上一个变量,即是一个方法.这个附加的参数会将该函数附加到这种类型上,即相当于为这种类型定义了一个独占的方法. package main import &quo ...
- js实现将时分秒转化成毫秒,将秒转化成时分秒
// 时间转为毫秒 timeToSec(time) { var hour = time.split('[0] var min = time.split('[1] var sec = time.spli ...
- Prometheus监控神器-Alertmanager篇(4)
本章节主要讲解Alertmanager高可用的搭建与配置的详细的知识内容. 为了提升Prometheus的服务可靠性,我们会部署两个或多个的Prometheus服务,两个Prometheus具有相同的 ...
- 牛客网数据库SQL实战解析(31-40题)
牛客网SQL刷题地址: https://www.nowcoder.com/ta/sql?page=0 牛客网数据库SQL实战解析(01-10题): https://blog.csdn.net/u010 ...
- 欢迎来到 C# 9.0(Welcome to C# 9.0)【纯手工翻译】
翻译自 Mads Torgersen 2020年5月20日的博文<Welcome to C# 9.0>,Mads Torgersen 是微软 C# 语言的首席设计师,也是微软 .NET 团 ...
- 外链专员怎么做提升自己的seo水平
http://www.wocaoseo.com/thread-281-1-1.html 我是一个外链专员,想提升自身的seo水平该怎么做? 随着SEO的学习,已经有了一段时间,平时也在思考好多事情,现 ...
- 常用Oracle SQL集锦
常用dml和query开并行 --开并行 ALTER SESSION FORCE PARALLEL DML PARALLEL 16; ALTER SESSION FORCE PARALLEL QUER ...
- Resharper 2020 免费破解版
如果你是一名.NET开发人员,但是你却不使用ReSharper,那么你就不是一个合格的码农了,因为这是一个强大的神器,你值得拥有!当然,用它的代价是,启动VS会变得非常慢,非常卡,但是需要知道,磨刀不 ...