I am new to thymeleaf and I have the following problem. I want to call a java method inside the html template but the method needs an argument but the issue is that no matter what I am passing for an argument the result is always null.
categories.html:
<p th:text="${postsCount(1)}"></p>
categoryController:
@ModelAttribute("postsCount")
public int getPostsCountInCategory(Integer categoryId) {
return categoryService.getPostsCountInCategory(categoryId);
}