forked from qangel/EECS-341-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
match.jsp
82 lines (82 loc) · 2.2 KB
/
match.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
<%
query = "select * from schedule;";
rs = srs.executeQuery(query);
rsmd = rs.getMetaData();
week = request.getParameter("week");
%>
<form action="<%=request.getRequestURL()%>" method="get">
<input type=hidden name="show" value="<%=show%>" />
<tr>
<td colspan="6" align="center">
<select name="week">
<option value="">Select a week</option>
<%for(int i=2; i <= rsmd.getColumnCount(); ++i) {%>
<option value="<%= rsmd.getColumnName(i) %>" <%
if(rsmd.getColumnName(i).equals(week)){%>selected<%}%>>
<%= rsmd.getColumnName(i) %>
</option>
<%}%>
</select>
<input type="submit" value="submit" />
</td>
</tr>
<%
if(week != null) {
boolean error=false;
query="select * from schedule;";
rs=srs.executeQuery(query);
try {rs.findColumn(week);}
catch (SQLException e) {error=true;}
if(!error) {
query="select p.position, p.name, s.calpoints from players p, "+
"weeklystats s where p.owner='"+user+"' and p.name=s.name;";
rs = srs.executeQuery(query);
rsmd = rs.getMetaData();
%>
<tr>
<td align="center" colspan="<%= rsmd.getColumnCount() %>">
<b>My team</b>
</td>
</tr>
<tr>
<% for(int i=1; i <= rsmd.getColumnCount(); ++i) { %>
<td><%= rsmd.getColumnName(i) %></td>
<% } %>
</tr>
<% while(rs.next()) { %>
<tr>
<% for(int i=1; i <= rsmd.getColumnCount(); ++i) { %>
<td><%= rs.getString(i) %></td>
<% } %>
<% } %>
</tr>
<%
query="select p.position, p.name, s.calpoints from players p, "+
"weeklystats s where "+
"owner=(select "+week+" from schedule where username='"+user+"') "+
"and p.name=s.name;";
rs = srs.executeQuery(query);
rsmd = rs.getMetaData();
%>
<tr>
<td align="center" colspan="<%= rsmd.getColumnCount() %>">
<b>Opposing team</b>
</td>
</tr>
<tr>
<% for(int i=1; i <= rsmd.getColumnCount(); ++i) { %>
<td><%= rsmd.getColumnName(i) %></td>
<% } %>
</tr>
<% while(rs.next()) { %>
<tr>
<% for(int i=1; i <= rsmd.getColumnCount(); ++i) { %>
<td><%= rs.getString(i) %></td>
<% } %>
</tr>
</form>
<%
}
}
}
%>