Skip to content

Tag: thymeleaf

How to set a object’s field using another objects field in thymeleaf

I’m trying to set boxes’ elements copied from medicineBox’s values like below. Can anyone help me in this. I need to post medicineOrder model to the controller I’m using two object here – medicine and medicineOrder ——————> Controller method to get the page ——————> thymeleaf html page —————> Controller method to handle the post request —————-> Class MedicineOrder Not able

How to fix Thymeleaf th:field unexpected error

I am new to Spring Boot and Thymeleaf. I tried to follow some example but got error as below with no any ideas… My Spring Boot version is 2.7.1 and Java 17 entity: controller: view: The th:field will get 500 internal error when I open this web page…. I’ve google and take a look in Thymeleaf document, but seems the

Convert String to Money Thymeleaf

I am having a problem converting input String to money. I am creating a spring boot application with thymeleaf. I have a web page where user inputs the data and there is a particular field where he inputs the String and it needs to be converted to type as in my pojo class that field has money data type.

SpringBoot. Thymeleaf. How to make table’s column clickable to send request to Controller?

I’ve created table with 8 columns: In fact each column (tag “td”) should serve as a button and after clicking send me to controller (@PostMapping or @GetMapping), where I will try to read th:value. How to make it? Instead of th:attr=”action=@{/}” I’ve tried to use th:href=”@{/}” – does not work. I’ve tried to insert between tags “td” the Form Button,

How to send the data finded in the controller to a view?

I try to do a java web application using: SpringBoot Mysql JDBC Design pattern: MVC, DAO And Thymeleaf I think i understood than: I must create a class for every Entity and a DAO classe who use the annotation @Repository: And create a controller like this where I use the method from the DAO: What i don’t understand:

post method not supported in patch method

I want edit entity with validating by hibernate-validator, but when calling the patch method, an error is thrown: post method not supported. How to make @PatchMapping work correctly? I am a beginner developer, help me please. Controller: Service: Repository: html form: Answer you can not use ‘PATCH’ for the form method attribute. only ‘GET’ and ‘POST’ methods are allowed(source).