public UserEditBean() { HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); if (request.getParameter("id") != null) { int userId = Integer.valueOf(request.getParameter("id")); Session session = HibernateUtil.getSession(); UserDAO dao = new UserDAO(session); user = dao.findByID(userId); } }
public String save() { Session session = HibernateUtil.getSession(); UserDAO dao = new UserDAO(session); dao.update(user); return "/admin/user/list?faces-redirect=true"; }