protected void userlist(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); List<Userbean> userlists=new Userservice().userlist(); request.setAttribute("Userlists", userlists); request.getRequestDispatcher("/index/userlist.jsp").forward(request, response); }
public List<Userbean> userlist() { Session session = HibernateUtils.getCurrentSession(); Transaction tr = session.beginTransaction(); List<Userbean> uList=null; try { uList=new Userdao().userlist(); tr.commit(); } catch (Exception e) { e.printStackTrace(); tr.rollback(); } return uList; }