zoukankan      html  css  js  c++  java
  • SpringBoot+Thymeleaf问题

    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>
    

      

  • 相关阅读:
    焦点Banner效果滚动
    缓冲效果
    招商银行购物网站的产品展示效果,循环播放
    神是怎么看待计算机的呢
    Liaoning Province保三成功
    JAR文件(文件格式)
    tamarin系列之5] 植入本地方法实现
    无线上把锁:WEP、WPA无线加密方式对比
    Tamarin
    V8 Javascript 引擎设计理念
  • 原文地址:https://www.cnblogs.com/shiysin/p/10569707.html
Copyright © 2011-2022 走看看