๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

์ „์ฒด ๊ธ€122

Spring - ์›น MVC ์˜ˆ์ œ (ํšŒ์› ์กฐํšŒ) Model addAttribute(String name, Object value) - value ๊ฐ์ฒด๋ฅผ name ์ด๋ฆ„์œผ๋กœ ์ถ”๊ฐ€ํ•œ๋‹ค. ๋ทฐ ์ฝ”๋“œ์—์„œ๋Š” name์œผ๋กœ ์ง€์ •ํ•œ ์ด๋ฆ„์„ ํ†ตํ•ด์„œ value๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. Model addAttribute(Object value) - value๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. value์˜ ํŒจํ‚ค์ง€ ์ด๋ฆ„์„ ์ œ์™ธํ•œ ๋‹จ์ˆœ ํด๋ž˜์Šค ์ด๋ฆ„์„ ๋ชจ๋ธ ์ด๋ฆ„์œผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค. ์ด ๋•Œ ์ฒซ ๊ธ€์ž๋Š” ์†Œ๋ฌธ์ž๋กœ ์ฒ˜๋ฆฌํ•œ๋‹ค. - value๊ฐ€ ๋ฐฐ์—ด์ด๊ฑฐ๋‚˜ ์ปฌ๋ ‰์…˜์ธ ๊ฒฝ์šฐ ์ฒซ ๋ฒˆ์งธ ์›์†Œ์˜ ํด๋ž˜์Šค ์ด๋ฆ„ ๋’ค์— "List"๋ฅผ ๋ถ™์ธ ๊ฑธ ๋ชจ๋ธ ์ด๋ฆ„์œผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค. ์ด ๊ฒฝ์šฐ์—๋„ ํด๋ž˜์Šค ์ด๋ฆ„์˜ ์ฒซ์ž๋Š” ์†Œ๋ฌธ์ž๋กœ ์ฒ˜๋ฆฌํ•œ๋‹ค. ์ถœ์ฒ˜: https://devlogofchris.tistory.com/53 ํšŒ์›์กฐํšŒ ์ปจํŠธ๋กค๋Ÿฌ @GetMapping("/members.. 2023. 7. 4.
Spring - ์›น MVC ์˜ˆ์ œ (ํšŒ์› ๋“ฑ๋ก) ํšŒ์› ๋“ฑ๋ก ํผ ์ปจํŠธ๋กค๋Ÿฌ ์ƒ์„ฑ @Controller public class MemberController { // private final MemberService memberService = new MemberService(); private final MemberService memberService; //์ปจํŠธ๋กค๋Ÿฌ์™€ ์„œ๋น„์Šค๋ฅผ ์—ฐ๊ฒฐ @Autowired public MemberController(MemberService memberService) { this.memberService = memberService; } @GetMapping("/members/new") public String createForm() { return "members/createMemberForm"; } @PostMapping(.. 2023. 7. 4.
Spring - ์›นMVC ์˜ˆ์ œ (ํ™ˆํ™”๋ฉด ์ถ”๊ฐ€) HomeController ์ถ”๊ฐ€ @Controller public class HomeController { @GetMapping("/") public String home(){ return "home"; } } home.html๋กœ ๊ฒฝ๋กœ ์„ค์ •! ๐ŸŽ€ ์ •์ ์ปจํ…์ธ ๋ณด๋‹ค Controller์—์„œ์˜ ๋งคํ•‘์ด ์šฐ์„ ์ˆœ์œ„๊ฐ€ ๋” ๋†’๋‹ค. 2023. 7. 4.
Spring - ์Šคํ”„๋ง๋นˆ๊ณผ์˜ ์˜์กด๊ด€๊ณ„2 ์ž๋ฐ” ์ฝ”๋“œ๋กœ ์ง์ ‘ ์Šคํ”„๋ง ๋นˆ ๋“ฑ๋กํ•˜๊ธฐ ./hello.hellospring/SpringConfig.java package hello.hellospring; import hello.hellospring.repository.JdbcTemplateMemberRepository; import hello.hellospring.repository.MemberRepository; import hello.hellospring.repository.MemoryMemberRepository; import hello.hellospring.service.MemberService; import org.springframework.beans.factory.annotation.Autowired; import org.springfram.. 2023. 7. 4.