-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab5_5.txt
38 lines (33 loc) · 990 Bytes
/
lab5_5.txt
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
33
34
35
36
37
38
//result.jsp
<%@ page import="java.util.*" %>
<html>
<head>
<title>Student Result</title>
<style>
.pass {
color: green;
}
.fail {
color: red;
}
</style>
</head>
<body>
<h2>Student Result</h2>
<p>Name: <%= session.getAttribute("name") %></p>
<p>Student ID: <%= session.getAttribute("studentId") %></p>
<p>Department: <%= session.getAttribute("department") %></p>
<h3>Marks</h3>
<%
int[] marks = (int[]) session.getAttribute("marks");
for (int i = 0; i < marks.length; i++) {
out.println("Subject " + (i+1) + ": " + marks[i] + "<br>");
}
boolean pass = (boolean) session.getAttribute("pass");
%>
<h3 class="<%= pass ? "pass" : "fail" %>">
<%= pass ? "Congratulations! You Passed!" : "Sorry, You Failed!" %>
</h3>
<p>Name of Servlet: <%= request.getServletPath() %></p>
</body>
</html>