前後端傳參帶兩個參數

前端頁面:

       <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";
    }

這裏的路徑要對應 

 

路徑傳參需要用這個進行接收 

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