-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewMedicalRecordsServlet.java
More file actions
28 lines (23 loc) · 1.04 KB
/
Copy pathViewMedicalRecordsServlet.java
File metadata and controls
28 lines (23 loc) · 1.04 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
package com.servlet;
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("/ViewMedicalRecordsServlet")
public class ViewMedicalRecordsServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
HttpSession session = (HttpSession) request.getSession();
Boolean loggedInPatient = (Boolean) session.getAttribute("loggedInPatient");
if (loggedInPatient != null && loggedInPatient) {
// Retrieve medical records for the patient from the database
// Display medical records
response.getWriter().println("Medical Records:");
// Logic to fetch and display medical records
} else {
response.sendRedirect("patient_login.html");
}
}
}