-
Client에서 요청할 때 Get방식으로 값을 보낼 경우 RequestParam으로 읽는다
html
<form action="/testadd" method="get"> <div> <label class="form-label">TestAdd</label> <input type="text" name="num" value = "100"> <button type="submit">Add</button> </div> </form>
java spring
import org.springframework.web.bind.annotation.RequestParam; @GetMapping("/testadd") //ex: testadd?num=100 public String mustache1TestaddPage(@RequestParam Long num) { for(int i = 0; i < num; i++) { //work... } return "redirect:/list"; }
'Spring' 카테고리의 다른 글
Java SpringBoot 개요 (0) 2023.07.07 Java SpringFramework 개요 (0) 2023.07.07 Springboot Mustach Jpa 이용한 게시판 (0) 2022.09.28 PathVariable Url경로에서 값 읽기 (0) 2022.09.28 lombok (0) 2022.09.27 Jpa 참고 문서 (0) 2022.09.27 Springboot Db기록Ex (0) 2022.09.26 spring.jpa.hibernate.hbm2ddl.auto (0) 2022.09.26