springboot在controller返回数据到thymeleaf报404

用springboot做一个例子,访问controller可以返回数据,但是到thymeleaf却报404,

检查发现路径等没有问题,查阅资料得知

这是因为maven仓库jar包问题,把maven仓库中的所有jar包都删除了,然后重新下载,再启动项目

或者在pom文件的

properties

标签下加入

 <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>

  

Thymeleaf页面的jquery无效

在<head>标签中写的jquery无效

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="fragment::header">
<meta charset="UTF-8">
<title></title>
<script>
...... // 此处会被覆盖
</script>
</head>

  

原因:使用  <head th:include="fragment::header">  集中引入外部资源时,会覆盖原页面中的<head>标签,则<script>标签中的代码在页面源码会不存在

引入后的页面源码<head>:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="/css/style.css" rel="stylesheet"/>
<link href="/bootstrap/css/bootstrap.css" rel="stylesheet"/>
<script src="/js/jquery-3.0.0.min.js" type="text/javascript"></script>
<script src="/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<title>fragment</title>
</head>

  

SpringBoot+Thymeleaf问题的更多相关文章

  1. org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method service() cannot be found on com.my.blog.springboot.thymeleaf.util.MethodTest type

    前言 本文中提到的解决方案,源码地址在:springboot-thymeleaf,希望可以帮你解决问题. 至于为什么已经写了一篇文章thymeleaf模板引擎调用java类中的方法,又多此一举的单独整 ...

  2. springboot+thymeleaf+pageHelper带条件分页查询

    html层 <div> <a class="num"><b th:text="'共 '+ ${result.resultMap['pages ...

  3. springboot+thymeleaf简单使用

    关于springboot想必很多人都在使用,由于公司项目一直使用的是SpringMVC,所以自己抽空体验了一下springboot的简单使用. 环境搭建 springbooot的环境搭建可以说很灵活, ...

  4. SpringBoot thymeleaf使用方法,thymeleaf模板迭代

    SpringBoot thymeleaf使用方法,thymeleaf模板迭代 SpringBoot thymeleaf 循环List.Map ============================= ...

  5. SpringBoot thymeleaf模板页面没提示,SpringBoot thymeleaf模板插件安装

    SpringBoot thymeleaf模板插件安装 SpringBoot thymeleaf模板Html页面没提示 SpringBoot  thymeleaf模板页面没提示 SpringBoot t ...

  6. SpringBoot thymeleaf模板版本,thymeleaf模板更换版本

    SpringBoot thymeleaf模板版本 thymeleaf模板更换版本 修改thymeleaf模板版本 ================================ ©Copyright ...

  7. Springboot+Thymeleaf框架的button错误

    ---恢复内容开始--- 在做公司项目时,遇到了一个Springboot+Thymeleaf框架问题: 使用框架写网站时,没有标明type类型的button默认成了‘submit’类型,每次点击按钮都 ...

  8. SpringBoot+Thymeleaf+iView

    SpringBoot+Thymeleaf参考: https://www.cnblogs.com/kibana/p/10236187.html 1.Controller: package cn.mmwe ...

  9. layui表格数据渲染SpringBoot+Thymeleaf返回的数据时报错(Caused by: org.attoparser.ParseException: Could not parse as expression: ")

    layui table渲染数据时报错(Caused by: org.attoparser.ParseException: Could not parse as expression: ") ...

  10. 不要再学 JSP 了,学 SpringBoot + Thymeleaf + Vue吧

    老读者就请肆无忌惮地点赞吧,微信搜索[沉默王二]关注这个在九朝古都洛阳苟且偷生的程序员.本文 GitHub github.com/itwanger 已收录,里面还有我精心为你准备的一线大厂面试题. 读 ...

随机推荐

  1. html页面转成jsp页面之后样式变化的问题解决方法

    转载:https://blog.csdn.net/zeb_perfect/article/details/51172859

  2. python 读取文本文档中的数据

    import os dir = input('Please input the file dir:')#提示输入文件路径 while not os.path.exists(dir):#判断文件是否存在 ...

  3. vins-mono中的imu参数设置

    na:加速度计的测量噪声 nw:陀螺仪的测量噪声 nba: randow walk noise随机游走噪声 nbw:randow walk noise随机游走噪声 ba:加速度计的偏差 bw:陀螺仪的 ...

  4. arcengine导出复本

    参考: https://gis.stackexchange.com/questions/172315/creating-checkout-replica-in-arcobjects-from-arcs ...

  5. Express全系列教程之(六):cookie的使用

    一.关于Cookie 在我们关闭一个登录过的网址并重新打开它后,我们的登录信息依然没有丢失:当我们浏览了商品后历史记录里出现了我们点击过的商品:当我们推回到首页后,推荐商品也为我们选出了相似物品:事实 ...

  6. kubernetes in action - Volumes

    Volume解决Kubernetes的存储的问题 对于Pod使用的存储,抽象为volume,volume伴随着Pod的创建而创建,消失而同时消失,不能单独的创建 这样的好处,是存储的塑胶不会因为某个c ...

  7. EE4218 / EE4216 Faculty of Science and Engineering

    Faculty of Science and EngineeringDepartment of Electronic and ComputerEngineeringEnd of Semester As ...

  8. LeetCode 705 Design HashSet 解题报告

    题目要求 Design a HashSet without using any built-in hash table libraries. To be specific, your design s ...

  9. inux中ifreq 结构体分析和使用(转)

    标签: it 分类: socket 结构原型: struct ifreq{#define IFHWADDRLEN 6 union {  char ifrn_name[IFNAMSIZ];   } if ...

  10. 使用charles过滤网络请求

    1.对网络请求进行过滤,只监控向指定目录服务器上发送的请求 有以下方法: (1)在Structure视图或者Sequence视图的Filter 栏中填入需要过滤出来的关键字(适合临时性封包过滤) 或者 ...