javaEE Springmvc,Json传输,@RequestBody(接收),@ResponseBody(发送)

Springmvc的jar包下载:https://pan.baidu.com/s/1Uu5R96z4LwwtydGq4B60Xg  密码:8c3n

需要额外导入Json的Jar包:jackson-annotations、jackson-core、jackson-databind

 

ItemController.java(Controller后端控制器,接收Json字符串,发送Json):

package com.xxx.springmvc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xxx.springmvc.pojo.Items;
import com.xxx.springmvc.service.ItemService;

//商品管理
@Controller
@RequestMapping(value = "/item")
public class ItemController {
	
	@Autowired
	private ItemService itemService;
	
	
	//json数据交互
	@Reques

你可能感兴趣的:(javaEE,java,javaee,Springmvc,Json,@ResponseBody)