스프링 웹 개발 기초
- 정적 컨텐츠
- 파일을 웹 브라우저에 그대로 내려주는 거
- MVC와 템플릿 엔진
- JSP나 PHP가 템플릿 엔진임. html을 그냥 주는 게 아니라 서버에서 프로그래밍을 해서 html을 동적으로 바꿔서 내리는 거
- model-view-controller 패턴으로 개발을 함
- API
- JSON 포맷으로 클라이언트에게 데이터를 전달
- 서버끼리 통신할 때 활용
✔️ 정적 컨텐츠와 MVC/템플릿 엔진의 차이는!
- 정적 컨텐츠는 웹 페이지에 파일을 그대로 내려주는 거
- MVC/템플릿 엔진은 서버에서 변형을 해서 내려주는 거
정적 컨텐츠
💾resources > static > hello-static.html
<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>static content</title>
</head>
<body>
정적 컨텐츠입니다.
</body>
</html>
- `hello-static.html`로 들어가면 텍스트가 나오는 걸 확인할 수 있다.
✔️ 정적 컨텐츠 이미지
- Controller가 우선순위를 가짐. 그래서 Controller에서 `hello-static.html`이 있는지 찾아봄
- 그 다음에 resources/static에서 `hello-static.html`이 있는지 찾음
[스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술] 강의 기록
300x250
'Framekwork > SPRING' 카테고리의 다른 글
[자바/스프링] 스프링 빈과 의존관계 (0) | 2023.02.20 |
---|---|
[자바/스프링] API (getter, setter, json) (0) | 2023.02.14 |
[자바/스프링] 빌드하고 실행하기 (윈도우) (0) | 2023.02.11 |
[자바/스프링] `spring-boot-devtools` 라이브러리 추가 (0) | 2023.02.10 |
[자바/스프링] View 환경설정 (add. thymeleaf ) (0) | 2023.02.09 |