学习中,在使用thymeleaf中,出现的问题

数据库是Account,字段为账户aid ,账户余额money,用户编号uid

Controller层        AccountController

@Controller
@RequestMapping("/acc")
public class AccountController {@Autowiredprivate AccountService accountService;@GetMapping("/ac")public String query(ModelMap modelMap){List<Account> accounts = accountService.accounts();modelMap.put("accounts",accounts);return "account-list";}
}

位于src/main/resources/templates文件下的account-list.html

<!DOCTYPE html>
<html lang="en" xmlns="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title><link rel="stylesheet" type="text/css"  th:href="@{../css/style.css}"/><script src="" th:src="@{../js/fu.js}"></script>
</head>
<body>
<img th:src="@{../images/wode.jpg}" class="wode"/>
<h1>用户列表展示</h1>
<table border="1"><tr><th>序号</th><th>账户编号</th><th>账户余额</th><th>用户编号</th></tr><tr th:each="account,iterStat:${accounts}"><td th:text="${iterStat.index+1}"></td><td th:text=""></td><td th:text="${account.aid}"></td><td th:text="${account.money}"></td><td th:text="${account.uid}"></td></tr>
</table>
<hr/>
<br>
<button onclick="text()">点击测试</button>
</body>
</html>

访问localhost:8092/acc/ac出错,端口号我改过

解决:

1.注意不要+@RestController,否则下面返回的就不是一个页面,而是字符串了

 2.thymeleaf语法严格,页面引用不完整或者语法有问题,或者没写值,都会报错导致页面不显示

3.如果页面静态资源没加载出来,那就是资源引入路径的问题

<script src="" th:src="@{../js/fu.js}"></script>

看文件报错在哪,找到这一行,说在22行有问题,有一个空值

在这里有一个空值,把空值注释掉

运行,完美可以了

Springboot集成thymeleaf报此应用程序没有/error的显式映射,因此您将其视为回退。This application has no explicit mapping for /err相关推荐

  1. thymeleaf依赖_玩转SpringBoot集成 Thymeleaf 模版引擎

    随着互联网技术的发展,在前后端分离开发模式已经逐渐成为主流的今天,前后端技术的划分也越来越清晰,社会分工进一步细化,职业岗位也更加细分,慢慢开始就有了前端攻城狮和后端攻城狮,技术也进一步细分,出现了以 ...

  2. 九、SpringBoot集成Thymeleaf模板引擎

    Thymeleaf咋读!??? 呵呵,是不是一脸懵逼...哥用我的大学四级英文知识告诉你吧:[θaimlif]. 啥玩意?不会音标?...那你就这样叫它吧:"赛母李府",大部分中国 ...

  3. Springboot集成mabatis-plus报com.xly.entity.ClientNot Found TableInfoCache.

    Springboot集成mabatis-plus报com.xly.entity.ClientNot Found TableInfoCache. 在用springboot集成mabatis-plus做项 ...

  4. SpringBoot集成Redis报non null key required(已解决)

    SpringBoot集成Redis报non null key required(已解决) 注意是不是给的key值或传过来的值是不是空的,如果是空的就会报这个错 接下来将流程走下去: 1.创建Sprin ...

  5. 报This application has no explicit mapping for /error, so you are seeing this as a fallback解决方法

    [现象]SpringBoot项目中访问已经存在的url时,报如下错误: Whitelabel Error Page This application has no explicit mapping f ...

  6. 【SpringBoot】This application has no explicit mapping for /error,so you are seeing this as a fallback

    [问题现象] SpringBoot中,在请求链接无错误.Controller配置无错误的情况下,访问某个Controller链接接口时,提示错误: This application has no ex ...

  7. swagger访问报错This application has no explicit mapping for /error, so you are seeing this as a fallback

    swagger访问报错This application has no explicit mapping for /error, so you are seeing this as a fallback ...

  8. SpringBoot This application has no explicit mapping for /error, so you are seeing this as a fallback

    文章目录 SpringBoot This application has no explicit mapping for /error, so you are seeing this as a fal ...

  9. 玩转springboot:thymeleaf模板引擎入门程序

    一.前言 常用的模板引擎有:JSP.Velocity.Freemarker.Thymeleaf 但是,Springboot默认是不支持JSP的,默认使用thymeleaf模板引擎.而且,语法更简单,功 ...

最新文章

  1. LINUX系统管理员技术(Admin)-------第三天
  2. sql server排序慢_用Nginx实现接口慢查询并可示化展示TOP 20
  3. Hi3516A开发--内存换算
  4. android之PackageManager简单介绍
  5. PHP(二)——HTML基础
  6. 设置mysql表myisam_mysql myisam 优化设置设置
  7. Springboot 项目中 xml文件读取yml 配置文件
  8. html给背景架渐变,JS和CSS实现渐变背景特效的代码
  9. js获取/设置任意元素中间内容的兼容方法
  10. 读书笔记∣世界是数字的
  11. 【笔试/面试】—— linux(rpm)
  12. C++11基于范围的for循环
  13. 20170908在线编程之圆周上问两点间的距离问题
  14. android开源torrent解析,bt分析之bt种子制作(1)
  15. Jenkins下载插件,报java.net.SocketTimeoutException: Read timed out
  16. VIS2020 长论文摘要机翻
  17. 计算机怎么看ping,如何查看自己电脑的PING
  18. 陶森大学计算机专业收入水平,2019PayScale计算机专业本科薪水排行
  19. 网页设计之标题栏显示当前系统日期
  20. P1664 每日打卡心情好

热门文章

  1. 学生个人博客网页设计作品 学生个人网页模板 个人网页制作 HTML学生个人网站作业设计
  2. 微信小程序-JAVA实现微信支付功能(微信支付2.0)
  3. 第三方软件测试(软件检测)收费标准
  4. 首届智能网络产业论坛成都开幕 迅游科技抢先布局5G
  5. 计算机前沿技术云论文,计算机前沿技术论文.doc
  6. n%2==1什么意思?n/2什么意思?有n\2这种写法吗?
  7. 多点解读贝泰妮:火速转战H股,女人的钱究竟有多好赚?
  8. 遗传算法matlab_史上最强的MATLAB自学网站,你收藏了吗???
  9. KD树+BBF+KNN使用C#实现(3)
  10. 【SysML精粹】模块定义图