-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.jsp
97 lines (83 loc) · 4.24 KB
/
search.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
90
91
92
93
94
95
96
97
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%--
Document : search
Created on : Mar 21, 2015, 10:23:43 PM
Author : programmercore
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="search.css"/>
<link rel="stylesheet" href="reset.css"/>
<title>Not Decided</title>
</head>
<body>
<%@include file="loginchecker.jsp" %>
<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/MYANIMELISTBORN"
user="root" password="I'm insane"/>
<div class="container">
<div class="top_bar">
<h1>Not Decided</h1>
</div>
<div class="search_bar">
<form class="search_form" method="get" action="search.jsp">
<input name="searchparameter" class="search_input" placeholder="Search" type="text">
<input value="Go" type="submit">
</form>
<ul id="menu">
<li><a href="" >options</a>
<ul class="sub_menu">
<li><a href="profilepage.jsp" >Home</a></li>
<li><a href="profilepage.jsp" >Profile</a></li>
<li><a href="list.jsp" >Series list</a></li>
<li><a href="logout.jsp" >Logout</a></li>
</ul>
</li>
</ul>
</div>
<sql:query dataSource="${snapshot}" var="result">
SELECT * from Shows where Title like '%${param.searchparameter}%' order by Title;
</sql:query>
<div class="search_results">
<div class="result_field">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr class="search_space">
<th class="normal_header">Search Results</th>
<th class="normal_header" width="10%"><a href="">Type</a></th>
<th class="normal_header" width="10%" nowrap=""><a href="">Eps.</a></th>
<th class="normal_header" width="10%" nowrap=""><a href="">Score</a></th>
</tr>
<c:forEach var="row" items="${result.rows}">
<sql:query dataSource="${snapshot}" var="score">
select Round(avg(Score),2) as score from Listed where Show_ID = ${row.Show_ID};
</sql:query>
<tr>
<td class="show_info" align="center"><a href="showstemplate.jsp?id=${row.Show_ID}"><span id="enameval"><c:out value="${row.Title}"/></span></a></td>
<td class="show_info extra" align="center"><c:out value="${row.Type}"/></td>
<td class="show_info extra" align="center"><c:out value="${row.Episodes}"/></td>
<td class="show_info extra" align="center"><c:forEach var="scor" items="${score.rows}"><c:out value="${scor.score}" /></c:forEach></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
<div id="footer">
<div class="footer">
<a target = "_blank" href="https://www.twitter.com/asjadsohail" >Twitter</a>
<a target = "_blank" href="#" >Facebook</a>
<a target = "_blank" href="/terms" >Terms</a>
<a target = "_blank" href="/terms" >Privacy Policy</a>
<a target = "_top" href="mailto:[email protected]" >Contact</a>
</div>
</div>
</div>
</body>
</html>