SPRING

웹 개발 방식_정적 컨텐츠 전달

고민말고생각하는사람 2024. 2. 21. 21:54

웹 개발 방식에는

- 정적 컨텐츠 전달

- MVC + 템플릿 엔진

- API 등

이 있음.

 

정적 개발 방식은 클라이언트에서 온 요청에 대해 내용이 정해진 컨텐츠를 전달하는 방식임.

@GetMapping("/helpMe")
    public String help() {     
        return "helpMe";
    }

이전 글에서 썼듯, Controller에서 문자열을 반환하면 ViewResolver 를 통해 

resources/static/helpMe.html 이 반환된다.

 

아래 html이 그대로 전달 됨.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>정적 컨텐츠 전달</title>
</head>
<body>
    정적 컨텐츠. 내용에 변함이 없는 클라이언트한테 전달
</body>
</html>