前后端传参带两个参数

前端页面:

       <a title="评语" href="#"
                                               th:onclick="layer_show('评语','/admin/studentPaper/userListAfter/'+[[${paper.papersId}]]+'/'+[[${paper.studentUserId}]],900,500)"
                                               class="ml-5" style="text-decoration:none">评语</a>

后端Controller代码:

@RequestMapping("userListAfter/{papersId}/{studentUserId}")
    public String userListAfter(Model model,@PathVariable("papersId") Long papersId,@PathVariable("studentUserId") Long studentUserId){

        //拿到当前用户名对应的信息
        SysUser currentUser=sysUserMapper.selectByUsername(Utility.getCurrentUsername());

        List<PaperReply> paperReplies=paperReplyService.selectReplysBetweens(currentUser.getId(),studentUserId,papersId);

        SysUser otherUser=sysUserMapper.selectByPrimaryKey(studentUserId);
        model.addAttribute("currentUser",currentUser);
        model.addAttribute("otherUser",otherUser);
        model.addAttribute("paperReplies",paperReplies);
        model.addAttribute("paperId",papersId);

        return prefix1+"replyTeacher";
    }

这里的路径要对应 

 

路径传参需要用这个进行接收 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章