Thymeleaf Error resolving template [index],template might not exist or might not be accessible
文章目录
- 1. 导入依赖
- 2. 配置
- 2. 视图层
- 3. 创建页面
- 4. 检查target
- 5. 表达式
使用Thymeleaf 一共5步,检查一下看看是否符合规范
1. 导入依赖
<!--模板引擎--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>
2. 配置
application.properties
# thymeleaf相关配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
2. 视图层
做路径跳转
package com.imooc.dianping.controller.admin;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;@Controller
@RequestMapping("/admin/admin")
public class AdminController {@GetMapping("/index")public ModelAndView index() {ModelAndView modelAndView = new ModelAndView("/admin/admin/index");return modelAndView;}
}
3. 创建页面
默认:在templates目录下面创建页面
根据业务需求,在templates创建子包路径,和视图层相对应
4. 检查target
检查文件是否编译
5. 表达式
<p th:text="${name}"></p>
Thymeleaf Error resolving template [index],template might not exist or might not be accessible相关推荐
- SpringBoot:Error resolving template [index], template might not exist or might not be acce...解决方法
SpringBoot异常:Error resolving template [index], template might not exist or might not be accessible b ...
- Springboot 报错 Error resolving template [index]
控制台报错: Error resolving template [index], template might not exist or might not be accessible by any ...
- Error resolving template [], template might not exist or might not be accessible by any of the conf
一.问题: Error resolving template [/index], template might not exist or might not be accessible by any ...
- ElasticSearch 系列: Index Template
Index template Index template定义在创建新index时可以自动应用的settings和mappings. Elasticsearch根据与index名称匹配的index模式 ...
- SpringBoot(二)Error resolving template “xxx”, template might not exist or might not be accessible解决办法
SpringBoot 7 SpringBoot整合持久层技术 7.1 整合JDBC 7.1.1 修改pom文件 <?xml version="1.0" encoding=&q ...
- 解决Error resolving template [x] template might not exist or might not be accessible by any of the con
文章目录 1. 复现问题 2. 分析问题 2.1 检查pom依赖 2.2 详解thymeleaf引擎 2.2 检查yml配置 3. 解决问题 1. 复现问题 今天配置好shiro + jwt后,可以正 ...
- exception processing, template error resolving template
exception processing, template error resolving template 错误信息:Exception processing template "/vi ...
- TemplateInputException: Error resolving template 无法解析页面原因记录
报错如下: TemplateInputException: Error resolving template [search], template might not exist or might n ...
- IDEA中进行SpringBoot开发时提示:Error resolving template xxx, template might not exist or might not be acce
场景 IDEA中进行SpringBoot开发时提示: Error resolving template "xxx", template might not exist or mig ...
最新文章
- python 报错 IndentationError: expected an indented block SyntaxError: invalid character in identifie
- python是软件吗-python运行环境是什么
- 18python入门到精通_《Python从入门到精通(60课)》18 序列类型之元组
- linux ls 输出对齐,理解 Linux 中 `ls` 的输出
- Laravel的Class Laravel\Passport\Passport not found
- Android中AutoCompleteTextView的特殊使用方法
- 天梯 L2 这是二叉搜索树吗?
- Qt笔记-QSslSocket双向认证
- 苹果x来电闪光灯怎么设置_苹果6splus来电没有声音,苹果6sp听筒没有声音怎么回事...
- JAVAIO流经验总结
- Atitit.aticmd v4 新特性q39 添加定时器释放功能
- JS递归算法经典案例与分析
- 编译时的chenk api
- 每天一句英语(有道)
- 【微信小程序】设置画布字体
- 考研路上的那些一战二战三战成功与失败的故事系列之一
- LocalDate的用法与String互转
- 例7.6有5个学生坐在一起,问第5个学生多少岁,他说比第4个学生大2岁。
- golang中的gin框架学习
- 数据分析之拉勾网(三)