From the course: HTMX with Thymeleaf in Spring Boot

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Demonstrate hx-patch and hx-put with Spring Security

Demonstrate hx-patch and hx-put with Spring Security - Spring Boot Tutorial

From the course: HTMX with Thymeleaf in Spring Boot

Demonstrate hx-patch and hx-put with Spring Security

- [Instructor] With 03-10_begin/records-management open in IntelliJ, let's turn now to discuss how to use HX Patch or HX Put. The process for working with HX Patch or HX Put is very much the same as using HX delete, and fortunately we already have a script in place to help us attaching the CSRF headers and tokens. Let's start the application in the terminal by running Maven spring-boot run. When it's complete, let's open the browser and log in. Go ahead and click the view person, locate the email addresses, and let's click the pencil icon for edit. The first thing you should see is that the form says add email, which does not make sense contextually. We're going to have to change that. Open the editable-email-form.html, located under resources, person, editable-email-form, as well as the PersonController.java. Let's locate the show edit email form. Around line 148, let's hit enter at the end of the line and add a model attribute. We'll type edit with a value of true. Both methods for…

Contents