forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquerybooks.jsp
87 lines (64 loc) · 1.55 KB
/
querybooks.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
<html>
<style>
h2{color:navy;font:700 20pt arial}
h4 {color:brwon;font:700 11pt verdana}
td {font:700 10pt verdana}
a {font:700 10pt verdana;color:darkgreen}
</style>
<body bgcolor="beige">
<h2>Query Books</h2>
<form action="querybooks.jsp" method="post" >
<table>
<tr>
<td>
Category
<td>
<select name="cat">
<option value="all">All Categories
<option value="ora">Oracle
<option value=".net">.NET
<option value="java">Java
</select>
Title Contains
<input type=text name=title size=20>
</tr>
<tr>
<td>
Author Name Contains
<td>
<input type=text size=20 name=author>
Price From
<input type=text name=fromprice size=10>
To
<td>
<input type=text name=toprice size=10>
</tr>
</table>
<p>
<input type=submit value="Query">
<a href="gohome.jsp">Home Page </a>
</form>
<%
String cat = request.getParameter("cat");
if ( cat == null)
return;
String cond = "1=1";
if (!cat.equals("all") )
cond = cond + " and cat = '" + cat + "'";
String title = request.getParameter("title");
if ( !title.equals(""))
cond = cond + " and title like '%" + title + "%'";
String author = request.getParameter("author");
if ( !author.equals(""))
cond = cond + " and author like '%" + author + "%'";
String fromprice = request.getParameter("fromprice");
if ( !fromprice.equals(""))
cond = cond + " and price >= " + fromprice;
String toprice = request.getParameter("toprice");
if ( !toprice.equals(""))
cond = cond + " and price <= " + toprice;
request.setAttribute("cond", cond);
%>
<jsp:include page="listbooks.jsp" flush="true"/>
</body>
</html>