protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int id = Integer.parseInt(request.getParameter("id")); request.setAttribute("patient", PatientService.getById(id)); request.setAttribute("partialPage", "/Views/editPatientForm.jsp"); request.setAttribute("activeNavPill", "patient"); User user = (User) request.getSession().getAttribute("currentUser"); request.getRequestDispatcher(UserService.getTemplatePage(user)).forward(request, response); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("windows-1251"); int id = Integer.parseInt(request.getParameter("id")); Patient updatedPatient = TempAttributesToObj.getPatient(request); // TODO replace with JS get object from Form PatientService.update(updatedPatient); response.sendRedirect("/patientsView"); }