方法代码
@At("queryStuLesson")
@Ok("jsp:lesson")
public void queryStuLesson(HttpServletRequest request){
int stuid = Integer.parseInt(request.getParameter("stuid"));
Student students = dao.fetchLinks(dao.fetch(Student.class, stuid), "lesson");
List<Lesson> lesson = students.getLesson();
Lesson lesson2=new Lesson();
for (Lesson lesson1: lesson){
lesson2.setLesname(lesson1.getLesname());
if(lesson2!=null){
request.setAttribute("less",lesson2);
}
request.setAttribute("less","该学生没有课程");
}
}
前端代码
<div>${less}</div>
问答
为什么不为空时前端展示的数据就什么都没有 为空时才展示数据
标签:
无
添加回复
请先登陆