5
tôi kết thúc với rất nhiều mã như:Làm thế nào để đúng cách phớt lờ/hide yếu tố với Thymeleaf mẫu
<section layout:fragment="content" th:remove="tag">
<p>content section</p>
</section>
và
<section th:switch="${session['SOME_KEY'" th:remove="tag">
<section th:case="${'BadCredentialsException'}" th:remove="tag">
Invalid username/password
</section>
<section th:case="${'UsernameNotFoundException'}" th:remove="tag">
Invalid username/password
</section>
<section th:case="${'DisabledException'}" th:remove="tag">
Account is blocked, contact your admin
</section>
<section th:case="*" th:remove="tag">
Something went wrong
</section>
</section>
Lưu ý thứ: loại bỏ = "tag" để không hiển thị các thẻ phần trong trường hợp này như tôi không neem chúng.
Đây có phải là cách thích hợp để thực hiện việc này không?
Cảm ơn! Chính xác những gì tôi đang tìm kiếm. –