From 7526e82a3107e578364ab055eab9a8e111f7b7fd Mon Sep 17 00:00:00 2001 From: Sewaaa Date: Thu, 28 Dec 2023 23:23:20 +0100 Subject: [PATCH] print patient of X therapist v.3 --- .../java/controller/homeTherapistServlet.java | 2 -- src/main/java/model/DAO/DAOUser.java | 3 ++- src/main/webapp/JSP/testTable.jsp | 20 +++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/controller/homeTherapistServlet.java b/src/main/java/controller/homeTherapistServlet.java index 614626a..277b1b1 100644 --- a/src/main/java/controller/homeTherapistServlet.java +++ b/src/main/java/controller/homeTherapistServlet.java @@ -29,10 +29,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t ArrayList list_user=new ArrayList<>(); //String tipo=request.getParameter("type"); User logged= (User) session.getAttribute("user_logged"); - //User u= userService.getUserByIdOrEmail((User) session.getAttribute("user_logged")); //save in session attribute the id of the therapist by email list_user=userService.getUsersAndPersonalInfoByIdTherapist((Integer) logged.getId()); //save all patient of X therapist - session.setAttribute("list_user",list_user); diff --git a/src/main/java/model/DAO/DAOUser.java b/src/main/java/model/DAO/DAOUser.java index e221d8e..01b7427 100644 --- a/src/main/java/model/DAO/DAOUser.java +++ b/src/main/java/model/DAO/DAOUser.java @@ -282,7 +282,7 @@ public ArrayList getUsersAndPersonalInfoByIdTherapist(int idTherapist) ResultSet resultSet = null; ArrayList list_user=new ArrayList<>(); - UserInfo u=new UserInfo(); + try { connection = DAOConnection.getConnection(); @@ -296,6 +296,7 @@ public ArrayList getUsersAndPersonalInfoByIdTherapist(int idTherapist) resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { + UserInfo u=new UserInfo(); u.setId(resultSet.getInt("ID")); u.setEmail(resultSet.getString("Email")); u.setActivationDate(resultSet.getTimestamp("ActivationDate")); diff --git a/src/main/webapp/JSP/testTable.jsp b/src/main/webapp/JSP/testTable.jsp index e535c01..05b0091 100644 --- a/src/main/webapp/JSP/testTable.jsp +++ b/src/main/webapp/JSP/testTable.jsp @@ -49,10 +49,10 @@ - - - - + + + + @@ -63,11 +63,15 @@ for(UserInfo u: list_user){ %> - <% for (int j = 1; j <= 4; j++) { %> - - <% } %> + + + + - <% }} %> + <% + } + } + %>
Colonna 1Colonna 2Colonna 3Colonna 4IconaNomeCognomeInizio Terapia
Elemento <%= j %> <%=u.getEmail()%><%=u.getFirstname()%><%=u.getLastname()%><%=u.getActivationDate()%>