麻烦老师看一下为什么没有数据
package com.imooc.o2ov2.web.RESTful;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
@Controller
public class RESTful {
@RequestMapping("/emp/list/{DEPT}")
@ResponseBody
public String list(@PathVariable("DEPT") String dept){
List<Employee> list = new ArrayList<>();
if(dept.equals("DEPT")){
list.add(new Employee(1,"张三","男"));
list.add(new Employee(2,"李四","女"));
list.add(new Employee(3,"王五","男"));
}
System.out.println(dept);
return JSON.toJSONString(list);
}
}

21
收起
正在回答 回答被采纳积分+1
2回答
4. SSM到Spring Boot入门与综合实战
- 参与学习 人
- 提交作业 323 份
- 解答问题 8263 个
本阶段将带你学习主流框架SSM,以及SpringBoot ,打通成为Java工程师的最后一公里!
了解课程

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星