I'm not sure if this is the right place to post this but I've looked on Stackoverflow etc. and I couldn't find any reference to it.
I have been trying to make a simple GET <form>
This code did not render the form element as expected:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head th:replace="fragments/head::head(title='Film Fanaticos')"></head>
<body>
<header th:replace="fragments/header :: header"></header>
<main>
<br><br>
<div class="container-md">
<div class="alert alert-danger" role="alert">
<p class="text-centre">
<strong>Are you sure you want to delete yourself permanently?</strong>
<br>
<small>All of your films, scores and reviews will also be deleted.</small>
</p>
<form class="mx-2" th:method="GET" th:action="@{/user/delete}"}>
<button class="btn btn-danger profile-button mx-2" type="submit">Delete Profile</button>
<a href="#" class="alert-link mx-2" onclick="history.back()">Go Back</a>
</form>
</div>
</div>
</main>
<footer th:replace="fragments/footer :: footer"></footer>
</body>
</html>
This was the rendered HTML in the browswer:
<main>
<br><br>
<div class="container-md">
<div class="alert alert-danger" role="alert">
<p class="text-centre">
<strong>Are you sure you want to delete yourself permanently?</strong>
<br>
<small>All of your films, scores and reviews will also be deleted.</small>
</p>
<button class="btn btn-danger profile-button mx-2" type="submit">Delete Profile</button>
<a href="#" class="alert-link mx-2" onclick="history.back()">Go Back</a>
</div>
</div>
</main>
However, when I add an empty <form></form> tag before the <form> I want, it does render:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head th:replace="fragments/head::head(title='Film Fanaticos')"></head>
<body>
<header th:replace="fragments/header :: header"></header>
<main>
<br><br>
<div class="container-md">
<div class="alert alert-danger" role="alert">
<p class="text-centre">
<strong>Are you sure you want to delete yourself permanently?</strong>
<br>
<small>All of your films, scores and reviews will also be deleted.</small>
</p>
<form></form>
<form class="mx-2" th:method="GET" th:action="@{/user/delete}"}>
<button class="btn btn-danger profile-button mx-2" type="submit">Delete Profile</button>
<a href="#" class="alert-link mx-2" onclick="history.back()">Go Back</a>
</form>
</div>
</div>
</main>
<footer th:replace="fragments/footer :: footer"></footer>
</body>
</html>
Is rendered as:
<main>
<br><br>
<div class="container-md">
<div class="alert alert-danger" role="alert">
<p class="text-centre">
<strong>Are you sure you want to delete yourself permanently?</strong>
<br>
<small>All of your films, scores and reviews will also be deleted.</small>
</p>
<form class="mx-2" method="GET" action="/user/delete" }="">
<button class="btn btn-danger profile-button mx-2" type="submit">Delete Profile</button>
<a href="#" class="alert-link mx-2" onclick="history.back()">Go Back</a>
</form>
</div>
</div>
</main>
I am using Spring Boot version 2.6.1 as well as the spring-boot-starter-thymeleaf, thymeleaf-extras-springsecurity5 and thymeleaf-extras-java8time dependencies.
Hello!
I'm not sure if this is the right place to post this but I've looked on Stackoverflow etc. and I couldn't find any reference to it.
I have been trying to make a simple GET
<form>
This code did not render the form element as expected:
This was the rendered HTML in the browswer:
However, when I add an empty
<form></form>
tag before the<form>
I want, it does render:Is rendered as:
I am using Spring Boot version 2.6.1 as well as the
spring-boot-starter-thymeleaf
,thymeleaf-extras-springsecurity5
andthymeleaf-extras-java8time
dependencies.Here is my
pom-xml
:Thanks!
EDIT: code formatting