<%@page import="com.godoro.inventrory.manager.*"%>
<%@page import="com.godoro.inventrory.entity.*"%>
<%@page import="java.util.*"%>
<%
String filter = request.getParameter("filter");
long selectedCategoryId = 0;
if (filter != null) {
selectedCategoryId = Long.parseLong(request.getParameter("categoryId"));
}
ProductManager productManager = new ProductManager();
List<Product>productList = productManager.listByCategoryId(selectedCategoryId);
CategoryManager categoryManager = new CategoryManager();
List<Category> categoryList = categoryManager.list();
Category nullCategory = new Category(0, "--Tümü--");
categoryList.add(0, nullCategory);
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>İlişki</title>
</head>
<body>
<h1>Ürün Özeti</h1>
<form method="POST">
Ulam :
<select name="categoryId">
<% for (Category category : categoryList) {%>
<option value="<%=category.getCategoryId()%>" <%=category.getCategoryId() == selectedCategoryId ? "selected" : ""%>>
<%=category.getCategoryName()%>
</option>
<% }%>
</select>
<input type="submit" value="Süz" name="filter"/><br/><br/>
<table border="1">
<tr>
<td>Ürün Kimliği</td>
<td>Ürün Adı</td>
<td>Satış Ederi</td>
<td>Ulam Adı</td>
</tr>
<% for (Product product : productList) {%>
<tr>
<td><%=product.getProductId()%></td>
<td><%=product.getProductName()%></td>
<td><%=product.getSalesPrice()%></td>
<td><%=product.getCategoryName()%></td>
</tr>
<% }%>
</table><br/>
<a href="ProductDetail.jsp">Ekle</a>
</form>
</body>
</html>
Dosyayı İndir