-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowProducts.jspx
94 lines (76 loc) · 2.77 KB
/
ShowProducts.jspx
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
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:my="http://jakarta.apache.org/tomcat/mytaglib"
xmlns:fn="http://java.sun.com/jsp/jstl/functions" >
<head>
<title>Catalogue</title>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" type="text/javascript" href="menu/menu.js"></link>
</head>
<body>
<c:set var="category" value="${applicationScope.catalog.categories}" />
<c:choose>
<c:when test="${requestScope.categoryID ne null}">
<c:set var="categories" value="${applicationScope.catalog.productsByCategories}" />
<c:forEach var="item" items="${categories}">
<c:if test="${item.key eq requestScope.categoryID}">
<c:set var="products" value="${item.value}" />
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<c:set var="products" value="${applicationScope.catalog.products}" />
</c:otherwise>
</c:choose>
<table align="left"><tr>
<td valign="top">
<div class="messageBox">
<table width="100%">
<tr class="header"><th colspan="4">Products</th></tr>
<tr><th>ID</th><th>Name</th><th>Price</th><th></th></tr>
<c:choose>
<c:when test="${requestScope.searchResults ne null}">
<c:forEach var="item" items="${products}">
<c:if test="${fn:containsIgnoreCase(item.value.productName, requestScope.searchResults)}">
<tr onmouseover="highlight(this)" onmouseout="lowlight(this)">
<td >${item.value.productID}</td>
<td align="left"><a href="Catalogue?productID=${item.value.productID}">${item.value.productName}</a></td>
<td align="right">${item.value.unitPrice}</td>
<td align="center">CAD</td>
</tr>
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${products}">
<c:choose>
<c:when test="${item.key eq requestScope.productID}">
<tr bgcolor="#FF6633">
</c:when>
<c:otherwise>
<tr onmouseover="highlight(this)" onmouseout="lowlight(this)" >
</c:otherwise>
</c:choose>
<td >${item.value.productID}</td>
<td align="left">
<c:url var="urlProduct" value="Catalogue">
<c:param name="productID" value="${item.value.productID}"/>
<c:param name="categoryID" value="${item.value.categoryID}"/>
</c:url>
<a href="${fn:escapeXml(urlProduct)}">${item.value.productName}</a>
</td>
<td align="right">${item.value.unitPrice}</td>
<td align="center">CAD</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>