From the course: Spring Web MVC 6
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Connect UI, controller, and data access code - Spring Tutorial
From the course: Spring Web MVC 6
Connect UI, controller, and data access code
- [Instructor] Now that we have the product controller, the product bean and the product repository ready with us, the next big step will be to connect everything. So we have to connect the HTML template with the controller, the controller to the data access, and then find out how the code works together. So let's go to the IDE and the first thing that I will do is open this fragments.html and look at the section for the search popup. So lines number 26 to 29 have the form element which is going to do the search popup functionality for you. So now what I can do is I will first go to line number 26 and quickly go ahead and modify this to th:method, so this is the Thymeleaf tag, we're saying th:method is post. And we can also define the action, so this action will be the URL mapping that we have defined in the product controller. So let's go there and find out what we mapped. This is the URL that we mapped. So this is what…
Contents
-
-
-
-
MVC controller annotations2m 31s
-
(Locked)
Create a Controller and Java bean for the search function6m 57s
-
(Locked)
Add a repository API to retrieve data from DB5m 48s
-
(Locked)
Connect UI, controller, and data access code5m 6s
-
(Locked)
Access model attributes on Thymeleaf UI11m 9s
-
(Locked)
Add a search string on the UI3m 21s
-
-
-
-
-
-