skip to Main Content

Javascript – How to pass variable from my JS file to Spring Boot Controller?

below is the code for selection of State and City in my view page( I am using thymeleaf 3) <div class="col-md-2"> <label for="inputCity" class="form-label">State</label> <select onchange="print_city('state', this.selectedIndex);" id="sts" name="stt" class="form-control" required> </select> </div> <div class="col-md-2"> <label for="inputCity" class="form-label">City</label> <select id="state"…

VIEW QUESTION

Thymeleaf does not show data in html page

I’m just studying Thymeleaf and I don’t understand why I can’t show data inside my html code. My Thymeleaf controller is as follows: @Controller public class UserController { @GetMapping("/index") public String getMessage(Model model) { model.addAttribute("welcome", "Hello!"); return "index"; } }…

VIEW QUESTION
Back To Top
Search