Cute Running Puppy

โ—์—๋Ÿฌํ•ด๊ฒฐ๋ชจ์Œ

# ๋ฐฐํฌ ํƒ€์ž„๋ฆฌํ”„ ๊ฒฝ๋กœ ์—๋Ÿฌ -org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing

๋ญ‰์ง€๋ง˜ 2025. 3. 11. 17:09

๋ฐฐํฌํ•˜๋‹ˆ๊นŒ ์—๋Ÿฌ๊ฐ€ ๋‚˜๊ณ  ์‹คํ–‰์ด ์•ˆ๋˜์„œ ๋งค์šฐ ๋‹นํ™ฉ์Šค๋Ÿฌ์› ๋Š”๋ฐ

org.thymeleaf.TemplateEngine: [THYMELEAF][http-nio-8090-exec-1] Exception processing template "index": 
An error happened during template parsing (template: "class path resource [templates/index.html]")

org.thymeleaf.exceptions.TemplateInputException: 
An error happened during template parsing 
(template: "class path resource [templates/index.html]")

์—๋Ÿฌ๊ฐ€ ๊ต‰์žฅํžˆ ๊ธธ์ง€๋งŒ ๋Œ€์ถฉ ์œ„์ชฝ์„ ์ฝ์–ด๋ณด๋‹ˆ ํƒ€์ž„๋ฆฌํ”„ ๊ด€๋ จ ์†์„ฑ์ด ์—๋Ÿฌ๊ฐ€ ์žˆ๋Š”๊ฒƒ ๊ฐ™์•˜๋‹ค.

 

๋ฌธ์ œ๋Š” ํƒ€์ž„๋ฆฌํ”„์—์„œ

th:replace= ๋กœ ๊ฐ€์ ธ์˜ฌ๋•Œ ๋งจ์•ž๋ถ€๋ถ„์— /๋ฅผ ํฌํ•จ์‹œ์ผœ์„œ ์ผ์–ด๋‚œ ๊ฒƒ์ด์—ˆ๋‹ค.

 

์˜ˆ์‹œ

<!-- # ๋‚ ์”จ ๋ฐ์ดํ„ฐ -->
<th:block th:replace="~{/comp/weather :: weatherFragment}">
</th:block>

์ด๋ ‡๊ฒŒ ๋˜์–ด์žˆ๋˜๊ฑธ

<!-- # ๋‚ ์”จ ๋ฐ์ดํ„ฐ -->
<th:block th:replace="~{comp/weather :: weatherFragment}">
</th:block>

์ด๋ ‡๊ฒŒ ๋ฐ”๊ฟ”์ฃผ๋‹ˆ ํ•ด๊ฒฐ๋˜์—ˆ๋‹ค.

 

๋—