티스토리 뷰
@RequestParam: request로부터 query 파라미터 값을 접근하기 위함
@RequestMapping(value="/order", method = RequestMethod.GET) ... @RequestParam(value="id", required=true) String id
GET: http://localhost:8081/order?id=1
optional: defaultValue, name, required, value
@PathVariable: 하나 또는 그 이상의 URL 값이 파라미터로 작동하는 동적URL을 처리함
@RequestMapping(value="/order/{id}", method = RequestMethod.GET) ... @PathVariable("id") String id
GET: http://localhost:8081/order/1
'프로그래밍 > Spring' 카테고리의 다른 글
Spring Data JPA Paging and Sorting 페이징과 정렬하기 (1) | 2018.10.30 |
---|---|
class를 JSON으로 변환 시 field 가공하기 (0) | 2018.03.26 |
CRUD Repositories Query Method (0) | 2018.02.13 |
Spring boot + hibernate로 프로젝트 생성하기 (2) | 2018.02.08 |
JAVA SPRING관련 용어정리 (0) | 2018.02.07 |
댓글