SpringMVC使用@RequestParam 获取 vue get传递参数 的对象值为undefined,vue里的get参数是那种写在params里面的

附上后端代码

@CrossOrigin
    @ResponseBody
    @RequestMapping(value = "/studentCourseQuery", method = RequestMethod.GET)
    public CourseQueryData courseQuery(@RequestParam("id")String id) throws SQLException {
        //String id=request.getParameter("id");
        System.out.println(id);
        List<Student_tt> l = ss.queryStudentCourseById(id);
        CourseQuery[] cq = new CourseQuery[l.size()];
        int i = 0;
        for (Student_tt stu : l) {
            cq[i] = new CourseQuery(stu.getClassno(), stu.getClassname(), ts.queryTnameById(stu.getTno()),
                    stu.getClasstime(), ss.queryCourseIntroductionByCourseId(stu.getClassno()));
            i++;
        }
        List<CourseQuery> list=new ArrayList<CourseQuery>();
        for (CourseQuery st : cq) {
            list.add(st);
        }
        JSONArray ja=JSONArray.fromObject(list);
        CourseQueryData data=new CourseQueryData(ja);
        //System.out.println(data.toString());
        return data;
    }
查看全部
weixin_43925196
龙乾
2020/04/21 11:05
  • spring
  • vue.js
  • ajax
  • java-ee
  • eclipse
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复