NutzCN Logo
问答 总是说数据转换出问题 求大神解答
发布于 2691天前 作者 wx_0quujkao0it5ekj89bt6 1708 次浏览 复制 上一个帖子 下一个帖子
标签:
    @At("queryTeacher")
    @Ok("jsp:show")
    public void QueryTeacher(HttpServletRequest request,HttpSession session){
        List<Teacher> teacherList = dao.query(Teacher.class, null);
        Teacher teacher2=new Teacher();
        for (Teacher teacher1 : teacherList){

            int lessId = teacher1.getLessId();
            teacher2.setLessId(lessId);
        }
        session.setAttribute("lessonid",teacher2);
        request.setAttribute("teacherlist",teacherList);
@At("deletelesson")
    @Ok(">>:queryTeacher")
    public boolean DeleteLesson(HttpServletRequest request, HttpSession session){
        int lessonid = Integer.parseInt(String.valueOf(session.getAttribute("lessonid")));
        Lesson lesson = dao.fetchLinks(dao.fetch(Lesson.class, lessonid), "students");
        request.setAttribute("lesson",lesson);
        return true;
    }
2 回复
session.setAttribute("lessonid",teacher2);

应该这样吧?

session.setAttribute("lessonid",lessId);

不过你传参真是够神奇的... 通过session传...

因为后面要用到这个Id 所以只好用session了 谢谢大神解答

添加回复
请先登陆
回到顶部