DEVELOP
article thumbnail
[ 인프런 - 스프링 입문 (김영한님) 강의 정리 ] 2. 스프링 웹 개발 기초
BACKEND/Spring 2022. 12. 25. 21:56

웹 개발 방식 정적 컨텐츠 : 고정된 파일을 그대로 전달 MVC와 템플릿 엔진 : html을 서버에서 변형해서 전달 API : 서버끼리 통신할 때 자주 사용 MVC와 템플릿 엔진 - 컨트롤러에서는 내부로직에 집중, 뷰에서는 화면을 그리는데 집중함 # Get 방식으로 데이터 받아 사용하기 ▽ 컨트롤러에 아래 코드 추가 @GetMapping("hello-mvc") public String helloMvc(@RequestParam("name") String name, Model model){ model.addAttribute("name",name); return "hello-template"; } ▽ resources/templates/hello-template.html hello. empty - localh..

article thumbnail
[ 인프런 - 스프링 입문 (김영한님) 강의 정리 ] 1. 프로젝트 환경설정
BACKEND/Spring 2022. 12. 25. 16:59

View환경설정 - Welcome Page 만들기 - 스프링 부트에서는 static/index.html을 등록하면 Welcome Page 기능을 제공 ▽ resources/static/index.html Hello World! Hello ▽ main/java/com.example.demo.controller/HelloController.java package com.example.demo.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @Controller public cl..