From 8e8ab9fafb56ba9e535cc7073ee01ecde27dd9e9 Mon Sep 17 00:00:00 2001 From: "ms@Nicro" Date: Sat, 6 Jan 2024 16:57:27 +0100 Subject: [PATCH] Added comments to help Michele --- src/main/java/controller/ExerciseController.java | 1 + src/main/java/controller/ExerciseLogger.java | 1 + src/main/webapp/JSP/exercise.jsp | 2 +- src/main/webapp/JSP/exerciseTest.jsp | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/controller/ExerciseController.java b/src/main/java/controller/ExerciseController.java index d7fd726..f138e85 100644 --- a/src/main/java/controller/ExerciseController.java +++ b/src/main/java/controller/ExerciseController.java @@ -15,6 +15,7 @@ public class ExerciseController extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { ExerciseManager em = new ExerciseManager(); String id = request.getParameter("exerciseID"); + //Aggiungi alla sessione insertion date @michele ExerciseGlossary ex = em.getExercise(Integer.parseInt(id)); request.getSession().setAttribute("exercise", ex); response.sendRedirect(request.getContextPath() + "/JSP/exercise.jsp"); diff --git a/src/main/java/controller/ExerciseLogger.java b/src/main/java/controller/ExerciseLogger.java index f27682c..5a0efa5 100644 --- a/src/main/java/controller/ExerciseLogger.java +++ b/src/main/java/controller/ExerciseLogger.java @@ -67,6 +67,7 @@ private boolean saveInDB(HttpServletRequest request, Blob execution){ int userId = Integer.parseInt((String) session.getAttribute("userId")); int exerciseId = Integer.parseInt((String) session.getAttribute("exerciseId")); Date insertDate = Date.valueOf((String) session.getAttribute("insertDate")); + //pulisci la sessione @michele return em.saveExecution(userId, exerciseId, insertDate, execution); } } \ No newline at end of file diff --git a/src/main/webapp/JSP/exercise.jsp b/src/main/webapp/JSP/exercise.jsp index 4e40637..96af0f7 100644 --- a/src/main/webapp/JSP/exercise.jsp +++ b/src/main/webapp/JSP/exercise.jsp @@ -5,7 +5,7 @@ <% ExerciseGlossary exercise = (ExerciseGlossary) session.getAttribute("exercise"); - session.removeAttribute("exercise"); + //session.removeAttribute("exercise"); @michele fallo nella homepage questa cosa, ovviamente controlla se prima esiste poi nel caso elimini %> Esercizio <%= exercise.getIdExercise()%> diff --git a/src/main/webapp/JSP/exerciseTest.jsp b/src/main/webapp/JSP/exerciseTest.jsp index e006189..df52ec4 100644 --- a/src/main/webapp/JSP/exerciseTest.jsp +++ b/src/main/webapp/JSP/exerciseTest.jsp @@ -29,6 +29,7 @@
+