博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IDEA| Error resolving template [index], template might not exist or might not be accessible by any
阅读量:2438 次
发布时间:2019-05-10

本文共 944 字,大约阅读时间需要 3 分钟。

报错:Error resolving template [index], template might not exist or might not be accessible by any of the configured.

使用环境:使用shpringboot搭建项目时候,后台COntroller返回页面地址报错提示找不到index.html。

原因:在使用springboot的过程中,如果使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错。

解决方案:

1、添加依赖

org.springframework.boot
spring-boot-starter-thymeleaf

2、配置环境

#thymelea模板配置spring.thymeleaf.prefix=classpath:/templates/spring.thymeleaf.suffix=.htmlspring.thymeleaf.mode=HTML5spring.thymeleaf.encoding=UTF-8spring.thymeleaf.content-type=text/htmlspring.thymeleaf.cache=falsespring.resources.chain.strategy.content.enabled=truespring.resources.chain.strategy.content.paths=/**spring.mvc.static-path-pattern=/static/**

3、(重要!!!)前端页面修改

    
kevin-视频播放

Note: html默认是<html lang="en">格式,就是这种格式导致无法解析为thymeleaf。将页头改为<html lang="en" xmlns:th="http://www.thymeleaf.org">即可解决问题。

转载地址:http://hfuqb.baihongyu.com/

你可能感兴趣的文章
近9成盗版Office用户称愿投奔开源(转)
查看>>
MySQL购InnoDB不敌甲骨文宣布开放数据引擎(转)
查看>>
银行监会选红旗Linux建设公文传输系统(转)
查看>>
红旗支撑国家外汇管理局网上核销系统(转)
查看>>
实例讲解密码破解以及抗击手段介绍(转)
查看>>
网上交易中帐号和密码被盗的解决途径(转)
查看>>
Java线程总结(转)
查看>>
Java学习之类的属性(转)
查看>>
轻松搞定Java内存泄漏(转)
查看>>
Java学习之值传递(转)
查看>>
Java 范型攻略篇(转)
查看>>
linux中crontab命令(转)
查看>>
牛人请进 小弟跪求(转)
查看>>
Linux版本凌乱痛失市场(转)
查看>>
大家好,新学生。 请问怎么升级Redhat9.0 kernel 2.4.X-->2.6.18 的详细过程(转)
查看>>
FreeBSD6.1+无线+永中......桌面安装【附笔记】(转)
查看>>
adsl设置(转)
查看>>
Wii将有一个可升级的Linux操作系统(转)
查看>>
Linux机为先锋智能机和PDA06销量大(转)
查看>>
Oracle与SQL Server在企业应用中的比较(转)
查看>>