-1

Page "bookUpdate.html" does not work correctly because of the errors. I can open this page from page "bookList.html" via click to button "Edit". On all other pages bootstrap work correctly. I try to add to code something like "link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" " but it did not work.

enter image description here

enter image description here

bookUpdate.html

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
layout:decorate="~{fragments/main_layout}">
<body>
<div layout:fragment="content" class="container mySpace">
    <form th:action="@{/bookUpdate/__${book.id}__}" th:object="${book.id}"
        method="post">
        <div class="form-group">
            <label for="topic" class="form-control-label">Topic</label> <input
                type="text" class="form-control" th:field="${book.topic}"
                id="topic" />
        </div>

        <div class="form-group">
            <label for="description" class="form-control-label">Description</label>
            <textarea class="form-control" th:field="${book.description}"
                id="description" style="height: 95px"></textarea>
        </div>

        <div class="form-group">
            <label for="link" class="form-control-label">Link</label> <input
                type="text" class="form-control" th:field="${book.link}" id="link" />
        </div>

        <input type="submit" value="Submit" class="btn btn-primary" />
    </form>
</div>
</body>
</html>
Anastasia
  • 23
  • 5

2 Answers2

0

I suggest you try changing "href" to "src", see this answer.

Also, be sure to look at the other responses in the same thread.

halfer
  • 19,824
  • 17
  • 99
  • 186
paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • Unfortunately, it does not work... Looks like this page did not upload packages with css, jquery and bootstrap that I got. – Anastasia Jul 20 '22 at 17:33
  • It was worth a try. Strictly speaking "href" is "correct": https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link. Q: Did you try any of the *OTHER* suggestions in the *OTHER* responses??? Please [Edit] your post, let us know what you tried, and update us on what did and didn't work. – paulsm4 Jul 20 '22 at 18:28
-1

I resolved my issue. I added a links to bootstrap from file "main_layout.html", that I use for header, and added before them <base href="/">. Now it is working fine.

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

<link rel="stylesheet" href="../../static/css/materia/bootstrap.min.css"
th:href="@{css/materia/bootstrap.min.css}" />
<script type="text/javascript" th:src="@{scripts/jquery-3.2.1.min.js}"></script>
</head>

enter image description here

Anastasia
  • 23
  • 5
  • Please consider removing the (duplicate?) "href" entries inside your element. [Edit] your reply with the final (working) code. Then, consider "Accepting" your reply, – paulsm4 Jul 20 '22 at 19:56