I would like to be able to display different data based on the previous category that was selected. For example, I currently have categories, that once clicked should redirect a user to a new page that displays all the relevant information for that category. The url should look something like localhost:8080/category/321 where the ID of that category is last. I
Tag: thymeleaf
Handle an exception in another method without losing the request objects from original one
There is an Exception that is thrown when an user is not found in database and i’d like to handle that particular exception from the controller perspective layer in a separated method by @ExceptionHandler annotation without losing the original data sent by the user. Well, so, i’m using Sessions and my first attempt was trying to get the object back
SpringBoot – i want to show login button for only users that are not logged-in
I am currently looking for a solution on how to not show the login button when a user is fully authenticated. This is for a personal project that I am doing. I want users to not be able to view the login button if they are connected, i already tried to look in the thymeleaf documentation i didn’t find an
How to control fields.hasErrors() and bindingResult manually
I’m trying to check if I have a List with items. So I use this code in my HTML Normally I should add @NonEmpty label in the form and let Spring work automatically. In my case, I can’t do it this way and I need to add the error manually. So I do this in my controller: But the message
spring boot security prevent the logged in user from seeing the login and registration pages
I am using Thymeleaf in the interface layer. I want to prohibit login and register pages when user is logged in. Is there any solution to this? Answer To enforce this, you can enable anonymous access (e.g. required to be anonymous to access this resource). See Common Built-In Expressions for a description of anonymous vs authenticated. You can use something
Is it possible to use thymeleaf variables to sum them in JS?
Here is the form I have ( many dishes where each has an input number ( quantity of dishes to order ). The problem is that I would like to show the price of an order before the order is done, for this I need to sum somehow input of the ${dish.price}, but how can this be done? JS (
DataTable to csv file
I have created a web page using bootstrap/thymeleaf where I show some data tables using Ajax. And I have the buttons to export to CSV, but what I need is to generate a temporary file from this datatable and get the path to my controller when the datatable is already loaded with the data using a button. So I need
testing code with a “real” Thymeleaf template engine and nothing else
In my Spring Boot project (v2.6), one of my components is using a Thymeleaf template engine to generate content. I want to unit test my component, but I am struggling because it has a TemplateEngine as a constructor dependency : I don’t want to mock the TemplateEngine (the test would not have great value), I would prefer to use a
Spring security loginProcessingUrl only works on localhost
I have built an application by using Spring Boot and Thymeleaf. My application works as supposed in my localhost, but when I package it as a .war and deploy it in a test tomcat server, it prompts the login page and then either redirects me to the error page or brings me back to the login page. I have tried
Spring Boot thymeleaf bad request 400 instead of showing user error
I am trying to submit a form using post request and first validate inputs. However when I make bad inputs (for example all empty) instead of showing error I get bad request (400). For showing error I am using th:if and th:errors tags in HTML. If I submit all valid inputs, there is no problem. Controller class: HTML form: Model