开发者

i want to show my error message from controller to html thymleaf spring boots

开发者 https://www.devze.com 2022-12-07 21:53 出处:网络
if(checkcode.isPresent()){ redirectAttributes.addFlashAttribute("errorMessage", "This products have already !");

            if(checkcode.isPresent()){ 
            
            redirectAttributes.addFlashAttribute("errorMessage", "This products have already !");
            return "redirect:/save-product";
            
        } else if (checkname.isPresent()) {
            
            redirectAttributes.addFlashAttribute("errorMessage", "This product have already !");
        开发者_Python百科    return "redirect:/save-product";
             
        }
<div th:if="${errorMessage}">
    <div th:text="${errorMessage}"></div>
</div>


This is my Controller and my div show error message to thymleaf but this one can't show on my thymleaf page


addFlashAttribute() Modify to addAttribute()

0

精彩评论

暂无评论...
验证码 换一张
取 消