-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathusercandprofile.jsp
89 lines (79 loc) · 2.09 KB
/
usercandprofile.jsp
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!-- Copyright (c) Nishit Tated. All Rights Reserved.
* Project name: Online Election Voting System
* This project is licensed under the MIT License, see LICENSE.
*/ -->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="model.Model, dao.Dao, java.sql.*, java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Give Vote</title>
</head>
<jsp:include page="header.jsp"></jsp:include>
<body>
<br><br><br><br><br><br><br><br>
<center>
<form action="Vote" >
<table border="5px">
<%
String sql = "select * from candidate";
int i = 0;
Dao d = new Dao();
try
{
ArrayList<ArrayList> list = new ArrayList<ArrayList>();
ResultSet rs = d.validate1(sql);
while(rs.next())
{
String party = rs.getString(1);
String fname = rs.getString(2);
String age = rs.getString(3);
String gender = rs.getString(6);
list.add(new ArrayList<String>());
list.get(i).add(party);
list.get(i).add(fname);
list.get(i).add(age);
list.get(i).add(gender);
i++;
}
HttpSession session1 = request.getSession();
session1.setAttribute("nlist",list);
}
catch(Exception e)
{
e.printStackTrace();
}
//ArrayList<ArrayList> a= (ArrayList<ArrayList>)session.getAttribute("nlist");
ArrayList<ArrayList> a = (ArrayList<ArrayList>)session.getAttribute("nlist");
for(int j=0;j<a.size();j++){
%>
<tr>
<td>
<p>PartyName: <%= a.get(j).get(0) %></p>
</td>
<td>
<p>Name: <%= a.get(j).get(1) %></p>
</td>
<td>
<p>Age: <%= a.get(j).get(2) %></p>
</td>
<td>
<p>Gender: <%= a.get(j).get(3) %></p>
</td>
<td>
Vote <input type="radio" name="vote" value="<%= a.get(j).get(0)%>">
</td>
</tr>
<%
}
%>
</table>
<br><br><br>
<input type="submit" name="submit" value="Submit" id ="submit" >
</form>
</center>
</body>
<jsp:include page="footer.jsp"></jsp:include>
</html>