๐จ Cocostudio + Thymeleaf ํตํฉ ๊ฐ์ด๋
๐ ์๋๋ฆฌ์ค: Cocostudio HTML์ Thymeleaf๋ก ๋ณํ
Cocostudio์์ ์์ฑํ HTML์ ๋์ ๊ฐ์ ์๋ฒ์์ ์ฃผ์
ํ๋ ๋ฐฉ๋ฒ์
๋๋ค.
1๏ธโฃ Cocostudio ์๋ณธ HTML
<div class="user-info">
์ฌ์ฉ์: {username}
์ด๋ฉ์ผ: {email}
</div>
<script>
const config = {
apiEndpoint: '{api-endpoint}',
secretKey: '{encrypted-secretKey}',
userId: '{user-id}'
};
</script>
2๏ธโฃ Thymeleaf๋ก ๋ณํ (์๋ฒ์์ ๋์ ์ฃผ์
)
<html xmlns:th="http://www.thymeleaf.org">
<div class="user-info">
์ฌ์ฉ์: <span th:text="${username}">ํ๊ธธ๋</span>
์ด๋ฉ์ผ: <span th:text="${email}">test@example.com</span>
</div>
<script th:inline="javascript">
const config = {
apiEndpoint: /*http://localhost:8080/api*/ 'http://localhost:8080/api',
secretKey: /*AES256_ENCRYPTED_KEY_SAMPLE_12345*/ 'default-key',
userId: /*USER_67890*/ '12345'
};
</script>
3๏ธโฃ ์ปจํธ๋กค๋ฌ์์ ๋ฐ์ดํฐ ์ ๋ฌ
@Controller
public class CocostudioController {
@GetMapping("/cocostudio-page")
public String cocostudioPage(Model model) {
model.addAttribute("username", "๊น์ฒ ์");
model.addAttribute("email", "kim@example.com");
model.addAttribute("apiEndpoint", "https://api.production.com/api");
model.addAttribute("encryptedSecretKey", "AES256_ENCRYPTED_KEY");
model.addAttribute("userId", "USER_67890");
return "cocostudio-page";
}
}
4๏ธโฃ ์ค์ ๋ ๋๋ง ๊ฒฐ๊ณผ (ํด๋ผ์ด์ธํธ๊ฐ ๋ฐ๋ HTML)
์ฌ์ฉ์: ๊น์ฒ ์ |
์ด๋ฉ์ผ: kim.chulsoo@example.com
JavaScript Config (๋์ ์ฃผ์
):
apiEndpoint: http://localhost:8080/api
secretKey: AES256_ENCRYPTED_KEY_SAMPLE_12345
userId: USER_67890
โ
Thymeleaf์ ์ฅ์
- โจ Natural Templates: Cocostudio HTML์ ๊ฑฐ์ ์์ ์์ด ์ฌ์ฉ
- ๐ ๋ณด์: ๋ฏผ๊ฐํ ํค๋ฅผ ์๋ฒ์์๋ง ๊ด๋ฆฌํ๊ณ ๋์ ์ฃผ์
- ๐ ํ๊ฒฝ๋ณ ์ค์ : Dev/Staging/Production ํ๊ฒฝ๋ง๋ค ๋ค๋ฅธ ๊ฐ ์ฃผ์
- ๐ JavaScript ํตํฉ: JS ๋ณ์์ ์๋ฒ ๋ฐ์ดํฐ ์ฃผ์
๊ฐ๋ฅ
- ๐จ ๋์์ด๋ ์นํ์ : HTML ํ์ผ์ ๋ธ๋ผ์ฐ์ ์์ ๋ฐ๋ก ํ์ธ ๊ฐ๋ฅ