原来返回一个json需要@Controller和@RequestBody配合使用。使用@Controller会返回一个html 和jsp页面。 源码如下,看出他被@Controller、@ResponseBody注解: /** * A convenience annotation that is itself annotated with * {@link Controller @Controller} and {@link ResponseBody @ResponseBody}. * <p> * Types...
2018.o2o.util.HttpServletRequestUtil;importcom.fasterxml.jackson.databind.ObjectMapper;@Controller@RequestMapping("/shopadmin")publicclassProductManagementController{@AutowiredprivateProductService productService;//支持上传图片详情图的最大数值privatestaticfinalintIMAGEMAXCOUNT=6;@RequestMapping(value="/addproduct",...