weixin_43925196
龙乾
2020-04-21 11:05
采纳率: 80%
浏览 1.1k

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;
    }
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • qq_36601979
    zyydomain 2020-04-21 14:19
    已采纳

    把前端的代码附上看下

    点赞 评论

相关推荐