-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubmitFeedbackServlet.java
More file actions
32 lines (24 loc) · 1.03 KB
/
Copy pathSubmitFeedbackServlet.java
File metadata and controls
32 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.servlet;
import com.dao.FeedbackDao;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet("/SubmitFeedbackServlet")
public class SubmitFeedbackServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException {
String feedback = request.getParameter("feedback");
HttpSession session = request.getSession();
String patientId = (String) session.getAttribute("patientId");
boolean success = FeedbackDao.saveFeedback(patientId, feedback);
if (success) {
response.sendRedirect("patient_module.jsp?feedbackSuccess=1");
} else {
response.sendRedirect("patient_feedback.jsp?feedbackError=1");
}
}
}