第一次执行list总要等几秒才显示页面(总共才2条记录),帮忙看下代码哪有问题,谢谢--------------- DAO代码public List<T> list (String hql){ Session session=HibernateSessionFactory.getSessionFactory().openSession(); try{session.beginTransaction();//开启事务 return session.createQuery(hql).list(); } finally{ session.getTransaction().commit(); session.close();//关闭hibernate会话 } }-----------------servlet代码 protected void list(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ // TODO Auto-generated method stub request.setAttribute("VM_error_list", baseDAO.list("from VmError")); response.sendRedirect(request.getContextPath()+"/VM_error_list.jsp"); }------------------------JSP部份代码<% List<VmError> list = (List<VmError>) request.getAttribute("VM_error_list"); SimpleDateFormat dateformat1=new SimpleDateFormat("yyyy-MM-dd"); if(list!=null&&list.size()>0) { for(int i=0;i<list.size();i++) { VmError item = list.get(i); String a1=dateformat1.format(item.getDate1()); String a2=dateformat1.format(item.getDate2()); %> <tr> <td><%=i+1%></td> <td><%=a1%></td> <td><%=item.getErrorInfo()%></td> <td><%=item.getOther()%></td> <td><%=item.getProcess()%></td> <td><%=item.getResult()%></td> <td><%=a2%></td>
添加回答
举报
0/150
提交
取消