337 questions
2
votes
1
answer
72
views
Login infinitely retrying with bad credentials
I am using Java Spring boot and Thymeleaf. When trying to login with bad credentials, the page freezes for a few minutes, and it says the page isn't working.
When I activate debug in application....
3
votes
1
answer
57
views
What's the use of Thymeleaf link expressions?
What's wrong with coding this:
<a th:href="'/view/'+${id}">Link Text</a>
instead of this:
<a th:href="@{/view/{id}(id=${id})}">Link Text</a>
Or if the ...
0
votes
1
answer
75
views
Thymeleaf th:object with th:with variable
I'm trying to centralize my Spring Model attribute names in a ModelConstants class for better refactoring safety, but I'm encountering persistent issues when trying to use these constants with th:...
0
votes
1
answer
40
views
How can I overwrite a single thymeleaf template from an external .jar?
I have an app already written and similarly to this post:
How to Load templates from external folder using Thymeleaf
I have the need to overwrite templates, in my case I don't care about redeploying ...
0
votes
0
answers
45
views
set default Locale in s SpringBoot - Thymeleaf
I have this template:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale != null ? #locale.language : 'en'}" lang="en">
<head>
...
0
votes
0
answers
72
views
Thymeleaf - Replace common parts in a fragment
I have a file named footerScripts.html:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<body>
<div th:fragment="common-scripts"&...
1
vote
0
answers
56
views
SpringBoot + Thymeleaf + Spring Security: loading images but no CSS
I have this template:
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta ...
1
vote
1
answer
218
views
using variables in hx-vars with spring boot and thymeleaf
I am trying to get htmx-spring-boot and htmx-spring-boot-thymeleaf 4.0.1 to work with my spring-boot 3.3.3 app.
I have filter and search inputs that I send via htmx to define a list of items. Since ...
0
votes
0
answers
13
views
Nested model object's properties evaluate differently in Thymeleaf if I use th:id instead of th:field
I keep getting lost on thymeleaf syntax so I'm pretty sure that the problem I'm facing is easily solved by a more focused mind than mine :) anyway I would like to ask what you think could be the best ...
0
votes
0
answers
13
views
Why custom dialect output html code that is not processed further by standard dialect?
I try to use custom dialect in thymeleaf, in order to dynamically add extra informations display in included fragments when context conditions are met. I would like to insert a div with a th:replace ...
0
votes
0
answers
27
views
conditional running header thymeleaf
I have a spring boot application that produces pdf from html template generated by SpringTemplateEngine and thymeleaf. The pdf is produced using com.openhtmltopdf.pdfboxout.PdfRendererBuilder
My issue ...
1
vote
0
answers
34
views
Validation not working in Spring Boot with Thymeleaf — Errors not displayed when fields are empty
In a Spring application I am using Thymleaf as a template. Errors are not displayed on the page
<form method="post" th:action="@{/add-client}" th:object="${clientRequestDto}...
1
vote
1
answer
61
views
Shopping cart deletetion bug
i tried to delete the last item from the cart. For all the previous item, the @GetMapping("remove-song-from-cart") work and return me to the cart page again but when hit the delete button of ...
1
vote
0
answers
36
views
Using thymeleaf-extras-springsecurity to expose OIDC UserInfo
I am trying to use the sec: tag to display fields from UserInfo in Spring Boot (3.3.5). I've included the dependency for thymeleaf-extras-springsecurity6 and the xmlns:sec. This works:
<div ...
1
vote
1
answer
103
views
How to prevent Thymleaf Page rendering when doing redirect (302)?
This is my spring-boot(3.3.5)/thymeleaf application pom.xml deps:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</...
0
votes
1
answer
201
views
Spring Boot App throwing a strange exception
I am following a tutorial and everything seems to work for the author but not for me.
The purpose of the use case is to add a new category (id, name, image and a boolean value).
Category entity:
@...
1
vote
1
answer
39
views
Thymeleaf syntax for the form action
I have this form:
<body>
<h1>Fill out the form</h1>
<form action="@{/submit}" method="post" th:object="${person}">
<span th:if="${#...
0
votes
0
answers
87
views
How can I overwrite inputs name attribute when thymeleaf automatically sets it when using th:field
In my thymeleaf template there is a form in which there is a radio button.
Looks like thymeleaf automatically gives a name to input name attribute.
This is the code:
<div>
<table th:each=&...
0
votes
1
answer
139
views
Thymeleaf cannot use th:each with th:replace in the same tag
I need to do the following
<tr th:fragment="rowFragment(rowObject)">
<td th:each="cellObject : ${rowObject.getCellObjects()}" th:replace="~{::cellFragment(...
2
votes
0
answers
216
views
Prevent escaping quotes in Thymeleaf attribute value
I'm trying use Thymleaf template to display html page that looks like this:
<html>
<body>
<my-webcomponent data='{"foo":"bar"}' ></my-webcomponent>
&...
-1
votes
1
answer
61
views
Is there a way to inject CSS properties inline with Thymeleaf?
Im structuring an email in the backend with Spring and Thymeleaf, and i have come across the following problem: I need to inject a color hex code as a CSS property while using inline CSS.
<span
...
0
votes
1
answer
474
views
SpringBoot3 does not log stacktrace
I'm migrating vom Spring5 to SpringBoot3.
Unfortunately (beside tons of other problems with e.g. spring security 6), spring boot does not log the problems and stacktraces, but keeps quiet.
e.g.:
To ...
1
vote
0
answers
34
views
Can/should you use th:attr with th:insert/replace in thymleaf? Fragments with elements whose attributes can be dynamically set
I like the principle of DRY (Don't repeat yourself) in coding. And while I continue to learn thymeleaf, I am running into this error I am unable to resolve.
So the general idea is as follows, I want ...
0
votes
0
answers
57
views
I want to save data from the same form to two different tables without declaring the second model in my save method
UserController.java:
@Controller
public class UserController {
@Autowired
private CensusRepository UR;
@GetMapping("/")
public String home(Model model){
...
0
votes
1
answer
150
views
Equivalent of JSP tag libraries for Thymeleaf
I have e.g. a custom JSP tag library files (tagx files) and want to know what would the equivalent for Thymeleaf? I'm using Thymeleaf with Spring.
My label.tagx:
<jsp:root xmlns:c="jakarta....