SimpleController.java > SPRING1

본문 바로가기

사이트 내 전체검색

뒤로가기 SPRING1

SimpleController.java

페이지 정보

작성자 관리자 작성일 24-07-17 11:10 조회 1,159 댓글 0

본문

package com.pkt.controller;


import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;


import com.pkt.model.ProductVO;


import lombok.extern.log4j.Log4j;


@Controller 

@RequestMapping("/sample/")

@Log4j

public class SampleController {


// JSON 테이타를 생성하기 위해서 @ResponseBody 추가해야 한다.

@RequestMapping("doJSON")

public @ResponseBody ProductVO json() {

log.info("doJSON.............. ");


ProductVO product = new ProductVO();


product.setName("Sample Product");

product.setPrice(10000);


return product; //객체 리턴

}

}


댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기