FE/html

조회 시 HTML 태그가 출력될 때(feat. Summernote)

잔망루피 2022. 8. 4. 22:19
반응형

Summernote 에디터를 이용해 저장하고 조회하니 HTML 태그까지 같이 출력되었다.

Thymeleaf를 사용했기 때문에 th:utext를 이용하는 것으로 해결했다.

<span class="card-body text-dark" th:utext="${post.content}"></span>

th:utext는 unescaped text다.

 

 

 

참고 👇

https://velog.io/@hellocdpa/220307-SpringBoot-%ED%83%80%EC%9E%84%EB%A6%AC%ED%94%84-%EC%8D%B8%EB%A8%B8%EB%85%B8%ED%8A%B8summernote-%EC%A0%80%EC%9E%A5%EA%B3%BC-%EC%A1%B0%ED%9A%8C

 

[22/03/06] SpringBoot 타임리프 썸머노트(summernote) 저장과 조회

게시판 글 작성란이 조금 밋밋한 것 같아서 summer note를 추가해보았다. 사용 방법은 정말 간단했다.

velog.io

 

https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html

 

Tutorial: Using Thymeleaf

1 Introducing Thymeleaf 1.1 What is Thymeleaf? Thymeleaf is a Java library. It is an XML/XHTML/HTML5 template engine able to apply a set of transformations to template files in order to display data and/or text produced by your applications. It is better s

www.thymeleaf.org

 

반응형