Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
7051CEM_Web_Applications_and_AI/WebContent/admin.jsp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
104 lines (74 sloc)
2.31 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="cfy.model.User"%> | |
<%@page import="cfy.model.Product"%> | |
<%@page import="java.util.List"%> | |
<% | |
List<Product> prod = (List<Product>) request.getAttribute("product"); | |
%> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>admin page</title> | |
<!-- font awesome cdn link --> | |
<link rel="stylesheet" | |
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | |
<!-- custom css file link --> | |
<link rel="stylesheet" href="./css/admin.css"> | |
<%@include file="/includes/head.jsp"%> | |
</head> | |
<body> | |
<%@include file="/includes/navbar.jsp"%> | |
<div class="container"> | |
<div class="admin-product-form-container"> | |
<form action="admin" method="post" enctype="multipart/form-data"> | |
<h3>add a new product</h3> | |
<input type="text" placeholder="enter product name" | |
name="product_name" class="box"> <input type="number" | |
placeholder="enter product price" name="product_price" class="box"> | |
<input type="text" placeholder="enter product details" | |
name="product_details" class="box"> <input type="text" | |
placeholder="enter product category" name="product_category" | |
class="box"> <input type="file" | |
accept="image/png, image/jpeg, image/jpg" name="product_image" | |
class="box"> <input type="submit" class="btn" | |
name="add_product" value="add product"> | |
</form> | |
</div> | |
<div class="product-display"> | |
<table class="product-display-table"> | |
<thead> | |
<tr> | |
<th>product image</th> | |
<th>product name</th> | |
<th>product price</th> | |
<th>product details</th> | |
<th>product category</th> | |
<th>action</th> | |
</tr> | |
</thead> | |
<% | |
for (Product p : prod) { | |
%> | |
<tr> | |
<td><img src="product-image/<%=p.getImage()%>" height="100" | |
alt=""></td> | |
<td><%=p.getName()%></td> | |
<td><%=p.getPrice()%></td> | |
<td><%=p.getDetails()%></td> | |
<td><%=p.getCategory()%></td> | |
<td><a href="admin?action=update&id=<%=p.getId()%>" class="btn"> <i class="fas fa-edit"></i> | |
edit | |
</a> <a href="admin?action=del&id=<%=p.getId()%>" class="btn"> <i | |
class="fas fa-trash"></i> delete | |
</a></td> | |
</tr> | |
<% | |
} | |
%> | |
</table> | |
</div> | |
</div> | |
</body> | |
</html> |