์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- ํ๋ค์ค
- JavaScript
- ์น๋์๋ณด๋ ์ ์
- REACT
- java
- RESTful API
- ํ์ด์ฌ
- ์๋ฐ
- ์๋ฐํ๋ก๊ทธ๋๋ฐ
- serverless
- ์๋๋ก์ด๋ ์คํ๋์ค
- ์๋๋ก์ด๋ ์ฑ ๊ฐ๋ฐ
- ํ๋ค์ค๊ณต๋ถ
- ์๋ฐ์ด๋ณด
- Flutter
- db
- ์คํธ๋ฆผ๋ฆฟ ๊ธฐ๋ณธ
- MySQL
- streamlit
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ์น๋์๋ณด๋ ๊ธฐ์ด
- ์๋ฐ๊ธฐ์ด
- Streamlit๊ธฐ์ด
- ํ์ด์ฌ๊ณต๋ถ
- Android
- Pandas
- ์๋ฐ์คํฌ๋ฆฝํธ ๊ณต๋ถ
- ์๋ฐ๊ณต๋ถ
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์คํธ๋ฆผ๋ฆฟ
- Today
- Total
ruriruriya
[Spring Boot] ์คํ๋ง๋ถํธ View ํ๊ฒฝ์ค์ (Welcom Page ๋ง๋ค๊ธฐ) ๋ณธ๋ฌธ
[Spring Boot] ์คํ๋ง๋ถํธ View ํ๊ฒฝ์ค์ (Welcom Page ๋ง๋ค๊ธฐ)
๋ฃจ๋ฆฌ์ผใ 2024. 3. 7. 14:51
์ง๋๋ฒ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊น์ง ๋ชจ๋ ํ์ธํ์ผ๋
HTML ํ์ผ์ ๋ง๋ค์ด Welcom Page๋ฅผ ๋ง๋ค์ด๋ณด์.
1. Welcom Page ๋ง๋ค๊ธฐ
recources - static์ index.html ํ์ผ์ ์์ฑํ๋ค.


๊ทธ๋ฆฌ๊ณ ์๋์ ๊ฐ์ด ๊ธฐ๋ณธํ์์ ์จ์ฃผ๊ณ
์๋ body์ aํ๊ทธ์ ๋งํฌ๋ url๋ฅผ ์จ์ค๋ค.

์ด๋ ๊ฒ ๊ฐ๋จํ๊ฒ ํด์ฃผ๊ณ ์คํํ๋ฉด
body์ ํ
์คํธ์ aํ๊ทธ ๋งํฌ๊ฐ ๋ฌ๋ฆฐ ํ
์คํธ๊ฐ ๋์จ๋ค.

์ฐธ๊ณ ํ๋ฉด ์ข์ ์๋ฃ
Spring Boot Features
Graceful shutdown is supported with all four embedded web servers (Jetty, Reactor Netty, Tomcat, and Undertow) and with both reactive and Servlet-based web applications. It occurs as part of closing the application context and is performed in the earliest
docs.spring.io
thymeleaf ํ ํ๋ฆฟ ์์ง
thymeleaf ๊ณต์ ์ฌ์ดํธ: https://www.thymeleaf.org/
์คํ๋ง ๊ณต์ ํํ ๋ฆฌ์ผ: https://spring.io/guides/gs/serving-web-content/
์คํ๋ง๋ถํธ ๋ฉ๋ด์ผ: https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/spring-boot-features.html#boot-features-spring-mvc-template-engines
2. Controller ์์ฑ
์ปจํธ๋กค๋ฌ๋ฅผ ๋ง๋ค์ด์ hello.html์ ์ฐพ์ ๋ณด์ฌ์ค ์ ์๊ฒ ํ๋ค.
controller ํจํค์ง ๋ด์ HelloController ํด๋์ค๋ฅผ ์์ฑํ๋ค.

@Controller ์ ๋ํ
์ด์
์ ์ด ํด๋์ค๊ฐ ์ปจํธ๋กค๋ฌ์์ ์คํ๋ง ํ๋ ์์ํฌ์ ์๋ฆฌ๊ณ
์ปจํธ๋กค๋ฌ๋ ์น ์์ฒญ์ ๋ฐ์๋ค์ด๊ณ ์๋ต์ ๋ฐํํ๋ ์ญํ ์ ํ๋ค.
@GetMapping("hello") ์ ๋ํ ์ด์ ์ ์ด ๋ฉ์๋๊ฐ /hello ๊ฒฝ๋ก๋ก ๋ค์ด์ค๋ GET ์์ฒญ์ ์ฒ๋ฆฌํ๋๋ก ์ง์ ๋ค.

Thymeleaf์ ๋ค์์คํ์ด์ค๋ฅผ ์ ์ธ(xmlns:th="http://www.thymeleaf.org")ํ html ํ์ผ์ templetes์ ๋ง๋ ๋ค.

๊ทธ๋ฆฌ๊ณ ์คํํด๋ณด๋ฉด ์ปจํธ๋กค๋ฌ์ ์๋ data ํค์ ๊ฐ์ ์๋ ํ์ธ์ ๋ค์ ๋ถ๋ฌ์จ๋ค.

ํค์ ๊ฐ์ ์๋์ ๊ฐ์ด ๋ฐ๊พธ๊ณ ๋ค์ ์ฌ์คํ์ ํ๋ฉด

์๋ ํ์ธ์ ๋ค์ ๋ฐ๋ data์ ๊ฐ์ผ๋ก ๋์จ๋ค.
