I am trying to call a method that returns a model and prints out a simple message to the console using Thymeleaf. However, I realize that whenever I setup the action to be called it does not work the way I want it to. The function does not get called. Though when I go into view page source
and click the button it does the desired action. I have tried to use th:action
instead but still get the same issue of it not getting the model and not doing the System.out.print("Works")
line of code. I have been stuck so long on this issue and have read some documentation, but I can't seem to figure out a way to solve it.
HTML:
<div class="modal-footer">
<a th:href="@{/mqlGetSecondQuery}" class="selectorBtn">
<button type="button" class="btn btn-primary modalPathContentBtn"
data-dismiss="modal">Continue</button>
</a>
</div>
Java:
@RequestMapping(value = "/mqlGetSecondQuery", method = RequestMethod.GET)
public void getMQLSecondQuery(Model model) {
model.addAttribute("queryResult", stringFromClass);
System.out.println("Works");
}