728x90 개발/Spring1 [스프링MVC] PostMapping Controller 작성 방법 1. @RequestParam 이용 @PostMapping("/add") public String addItemV1(@RequestParam String itemName, @RequestParam int price, @RequestParam Integer quantity, Model model){ Item item = new Item(); item.setItemName(itemName); item.setPrice(price); item.setQuantity(quantity); itemRepository.save(item); model.addAttribute("item", item); return "/basic/item"; } @RequestParam String itemName : itemName 요청 .. 2023. 2. 2. 이전 1 다음 728x90