Spring Boot + Thymeleaf Tag JAVA CUSTOM UTIL 사용
2023. 6. 27. 08:57ㆍ웹개발/Spring Boot
728x90
@Component
public class CustomUtils {
public static String removeTag(String html) throws Exception {
return html.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "");
}
}
자바 Class 에 Component 추가 후
Thymeleaf 에서
<span th:text="${@customUtils.removeTag(list.content)}"></span>
이런 식으로 사용할 수 있다.
728x90
반응형
'웹개발 > Spring Boot' 카테고리의 다른 글
JAVA Enum Value로 Key 찾아오기 (0) | 2023.07.06 |
---|---|
Spring Boot Controller 에서 전체 파라메터 폼 클래스 유효성 검증 (0) | 2023.07.05 |
Spring Boot Validated 유효성 검증 그룹 설정 (0) | 2023.07.04 |
Spring Boot 정적 리소스 설정 (0) | 2023.07.04 |
Spring Boot Security 사용자별 동시접속자 수 제어 (0) | 2023.06.30 |