Spring15 2022-09-22 스프링 @GetMapping("/addPerson") @ResponseBody public Person addPerson(int id, int age, String name) { Person p = new Person(id,age,name); return p; } } @Getter class Person { private int id; private int age; private String name; // public int getId () { // return id; // } // public int getAge () { // return age; // } // public String getName () { // return name; // } // 위에서 주석처리를 한 것이 lombok 라이브러리가 없었.. 2022. 9. 22. 2022-09-21 스프링(Spring) - 세션 사용 (저장과 가져오기) @Controller public class MainController { public static int i = 1; // @RequestMapping("/sbb") // @ResponseBody // public String index() { // System.out.println("sbb"); // return "sbb"; // } @RequestMapping("/saveSessionAge") @ResponseBody public String saveSession (@RequestParam("age")int age, HttpSession session) { session.setAttribute("age", age); return "나이 %d이 세션에 저장 되었습니다.".formatted(age); .. 2022. 9. 21. 2022-09-20 스프링(Spring) package com.mysite.sbb; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class MainController { public static int i = 1; @RequestMapping("/sbb") @ResponseBody public String index() { System.out.p.. 2022. 9. 21. 이전 1 2 3 다음