public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    HttpSession session = request.getSession();
    Student st = (Student) session.getAttribute("student");
    System.out.println("st.getName():" + st.getName());
    // 该语句用来通过HttpSession对象来获取ServletContext对象
    ServletContext sc = session.getServletContext();
    // 该语句用来通过WebUtil的getCustomerService静态方法,来获取CustomerService
    IStuClassService service = WebUtil.getStuClassService(sc);
    // 该语句用来通过委托Customer对象的delete方法来删除编号所对应的记录
    List<StudentScore> stulist = service.getAllScoreByStudentId(st.getId());

    // 该语句用来获取会话中所绑定的分页编号
    request.setAttribute("stulist", stulist);
    // 该语句用来获取跳转名page所对应的跳转路径
    return mapping.findForward("allScore");
  }
Esempio n. 2
0
 @Override
 public List<StudentByGrade> getAllStudentByGrade(int grade) {
   // TODO Auto-generated method stub
   List<Student> studentlist = this.studentDao.getAllStudentByGrade(grade);
   List<StudentByGrade> sbglist = new ArrayList<StudentByGrade>();
   if (studentlist == null || studentlist.size() <= 0) return null;
   else {
     for (Student s : studentlist) {
       StudentByGrade sbg = new StudentByGrade();
       sbg.setGrade(s.getGrade());
       sbg.setMajorID(s.getMajorID());
       Major m = this.majorDao.findById(s.getMajorID());
       sbg.setMajorname(m.getMajorname());
       sbg.setStudentid(s.getId());
       sbg.setStudentname(s.getName());
       sbglist.add(sbg);
     }
     return sbglist;
   }
 }