security的实战环节中可以实现登陆管理员,修改用户等所有功能但是不显示CSS样式

来源:11-5 -Spring Security 实战-前台编码

Pinkcoix

2019-01-19

图片描述
说明header和footer中的内容都正常替换了,但是为什么header中引入的CSS样式没有实现呢?引入方式完全参照老师来的.index中的引入:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:replace="~{fragments/header :: header}">
</head>

header中fragment的定义:

<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"
      th:fragment="header">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../../static/css/bootstrap/bootstrap.min.css" th:href="@{/static/css/bootstrap/bootstrap.css}">

    <!-- Bootstrap-chosen -->
    <link rel="stylesheet" href="../../static/css/bootstrap-chosen/bootstrap-chosen.css" th:href="@{/static/css/bootstrap-chosen/bootstrap-chosen.css}">

    <!-- tether -->
    <link rel="stylesheet" href="../../static/css/tether/tether.min.css" th:href="@{/static/css/tether/tether.min.css}">

    <!-- toastr -->
    <link rel="stylesheet" href="../../static/css/toastr/toastr.min.css" th:href="@{/static/css/toastr/toastr.min.css}">

    <!-- Thinker-md -->
    <link rel="stylesheet" href="../../static/css/thinker-md.vendor.css" th:href="@{/static/css/thinker-md.vendor.css}">

    <!-- Font awesome -->
    <link rel="stylesheet" href="../../static/css/fontawesome/font-awesome.min.css" th:href="@{/static/css/fontawesome/font-awesome.min.css}">

    <!-- jQuery tags input -->
    <link rel="stylesheet" href="../../static/css/jquery.tagsinput.css" th:href="@{/static/css/jquery.tagsinput.css}">
</head>

请问老师这是什么情况,已经卡了两天了.

写回答

1回答

老卫

2019-01-20

看下我是怎么写的。你应该是路径错了

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- CSRF -->

<meta name="_csrf" th:content="${_csrf.token}"/>

<!-- default header name is X-CSRF-TOKEN -->

<meta name="_csrf_header" th:content="${_csrf.headerName}"/>


<!-- Tether core CSS -->

<link href="../../css/tether.min.css" th:href="@{/css/tether.min.css}" rel="stylesheet">


<!-- Bootstrap CSS -->

<link href="../../css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet">


<!-- Font-Awesome CSS -->

<link href="../../css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet">


<!-- NProgress CSS -->

<link href="../../css/nprogress.css" th:href="@{/css/nprogress.css}" rel="stylesheet">


<!-- thinker-md CSS -->

<link href="../../css/thinker-md.vendor.css" th:href="@{/css/thinker-md.vendor.css}" rel="stylesheet">


<!-- bootstrap tags CSS -->

<link href="../../css/bootstrap-tagsinput.css" th:href="@{/css/jquery.tagsinput.min.css}" rel="stylesheet">


<!-- bootstrap chosen CSS -->

<link href="../../css/component-chosen.min.css" th:href="@{/css/component-chosen.min.css}" rel="stylesheet">


<!-- toastr CSS -->

<link href="../../css/toastr.min.css" th:href="@{/css/toastr.min.css}" rel="stylesheet">


<!-- jQuery image cropping plugin CSS -->

<link href="../../css/cropbox.css" th:href="@{/css/cropbox.css}" rel="stylesheet">


<!-- Custom styles -->

<link href="../../css/style.css" th:href="@{/css/style.css}" rel="stylesheet">

<link href="../../css/thymeleaf-bootstrap-paginator.css" th:href="@{/css/thymeleaf-bootstrap-paginator.css}"

         rel="stylesheet">

<link href="../../css/blog.css" th:href="@{/css/blog.css}" rel="stylesheet">

</head>


0
5
Pinkcoix
非常感谢!
2019-01-22
共5条回复

基于Spring Boot技术栈博客系统企业级前后端实战

毕设 Elasticsearch搜索+Thymeleaf模板+JPA+Security+BootStrap

1296 学习 · 738 问题

查看课程