JSON 데이터생성 @ResponseBody
Spring에서는 요즘 프로그래밍에서 많이 사용된다는 JSON 데이터에 대한 처리도 간단하게 할수 있게 도와준다.
일단 시작하기전에 pom.xml을 이용해서 jackson-databind 라이브러리를 추가해야 합니다.
<dependency> <groupID>com.fasterxml.jackson.core</groupID> <artifactID>jackson-databind</artifactID> <version>2.8.4</version> </dependency>
@Controller public class Controller { @RequestMapping("/doJSON") public @ResponseBody ProductVO doJSON { ProductVO vo = new ProductVO("샘플상품", 3000); return vo; } }
@ResponseBody에 대해서는 나중에 한번더 정리해야 할것 같다. ajax를 할때
'JAVA > spring' 카테고리의 다른 글
root-context.xml (2) SqlSessionTemplate (0) | 2017.09.11 |
---|---|
root-context.xml (1) Spring에서 Mapper 인식 (0) | 2017.09.11 |
Redirect: (0) | 2017.09.08 |
return 타입이 만들어져 있는 경우에는 (0) | 2017.09.06 |
return 타입이 String인 경우 (0) | 2017.09.06 |
댓글
이 글 공유하기
다른 글
-
root-context.xml (2) SqlSessionTemplate
root-context.xml (2) SqlSessionTemplate
2017.09.11 -
root-context.xml (1) Spring에서 Mapper 인식
root-context.xml (1) Spring에서 Mapper 인식
2017.09.11 -
Redirect:
Redirect:
2017.09.08 -
return 타입이 만들어져 있는 경우에는
return 타입이 만들어져 있는 경우에는
2017.09.06
댓글을 사용할 수 없습니다.