package cn.edu.tju.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
@Controller
public class JsonController {
@RequestMapping("/json")
public ModelAndView modelAndView(){
ModelAndView modelAndView = new ModelAndView(new MappingJackson2JsonView());
modelAndView.addObject("code", 200);
modelAndView.addObject("message", "my message");
return modelAndView;
}
}