<%@page import="com.godoro.inventrory.entity.*"%>
<%@page import="com.godoro.inventrory.manager.*"%>
<%@page import="java.util.*"%>
<%
String message = "L�tfen bilgileri giriniz.";
CategoryManager categoryManager = new CategoryManager();
List<Category> categoryList = categoryManager.list();
String insert = request.getParameter("insert");
if (insert != null) {
String productName = request.getParameter("productName");
double salesPrice = Double.parseDouble(request.getParameter("salesPrice"));
long categoryId = Long.parseLong(request.getParameter("categoryId"));
Product product = new Product(0, productName, salesPrice);
product.setCategoryId(categoryId);
ProductManager productManager = new ProductManager();
boolean inserted = productManager.insert(product);
message = "Kay�t eklendi " + productName + " " + salesPrice + " " + (inserted ? "Evet" : "Hay�r");
}
%>
<%@page contentType="text/html" pageEncoding="iso-8859-9"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
<title>�li�ki</title>
</head>
<body>
<h1>�r�n Ekleme</h1>
<i><%=message%></i><br/><br/>
<form method="POST">
�r�n Ad� : <input type="text" name="productName"/><br/><br/>
Sat�� Ederi : <input type="text" name="salesPrice"/><br/><br/>
Ulam :
<select name="categoryId">
<% for (Category category : categoryList) {%>
<option value="<%=category.getCategoryId()%>"><%=category.getCategoryName()%></option>
<% }%>
</select> <br/><br/>
<input type="submit" value="Ekle" name="insert"/>
</form><br/>
<a href="ProductSummary.jsp">Dizelge</a>
</body>
</html>
Dosyayı İndir