0% found this document useful (0 votes)
13 views3 pages

Purchase Order Form and Processing

The document contains an HTML form for a purchase order, requiring customer details and product information. It also includes a Java servlet that processes the form submission, calculates the total cost, and generates a summary of the purchase order. The servlet outputs the order details in an HTML format after processing the input data.

Uploaded by

misbhanmcc
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Purchase Order Form and Processing

The document contains an HTML form for a purchase order, requiring customer details and product information. It also includes a Java servlet that processes the form submission, calculates the total cost, and generates a summary of the purchase order. The servlet outputs the order details in an HTML format after processing the input data.

Uploaded by

misbhanmcc
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program-2

Filename : Purchase_order_form.html
<html>
<head>
<title>PurchaseOrderForms</title>
</head>
<body>
<h2>Purchase Order Forms</h2>
<form name="Purchase_order_form"action="ProcessPurchaseOrderServlet"
method="post">
<label for="cust_name">Customer Name:</label>
<input type="text"id="cust_name"name="cust_name"required><br>
<label for="place">Place:</label>
<input type="text"id="place"name="place"required><br>
<label for="contact_number">Contact Number:</label>
<input type="number"id="contact_number"name="contact_number"
required><br>
<label for="date">Date:</label>
<input type="text"id="date"name="date"required><br>
<label for="product_name">Product Name:</label>
<input type="text"id="product_name"name="product_name"required><br>
<label for="quantity">Quantity:</label>
<input type="number"id="quantity"name="quantity"required><br>
<label for="unit_price">Unit Price:</label>
<input type="text"id="unit_price"name="unit_price"required><br>
<button type="submit">Submit Purchase List</button>
</form>
</body>
</html>

Filename:[Link]
import [Link].*;
import [Link].*;
import [Link].*;
import [Link];
import [Link];
import [Link];
public class ProcessPurchaseOrderServlet extends HttpServlet
{
private static final long serialVersionUID=1L;
protected void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
String productName=[Link]("product_name");
int quantity=[Link]([Link]("quantity"));
double unitprice=[Link]([Link]("unit_price"));
String custname=[Link]("cust_name");
long contactnumber=[Link]([Link]
("contact_number"));
String place=[Link]("place");
String date=[Link]("date");
double totalCost=quantity * unitprice;
[Link]("text/html");
PrintWriter out=[Link]();
[Link]("<html><body>");
[Link]("<h1>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;
XYZ Companies &ensp;</h1>");
[Link]("<h2>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;
Purchase Order Summary &ensp;</h1>");
[Link]("<table style=width:700px>");
[Link]("<tr><th>Customer Name:"+custname+"</th><th>Distributer
code:DC001</th></tr>");
[Link]("<tr><th>Customer Place:"+place+"</th><th>Purchase Order
code:PC001</th></tr>");
[Link]("<tr><th>Contact
Number:"+contactnumber+"</th><th>Date:"+date+"</th></tr>");
[Link]("</table>");
[Link]("<table border=1 bgcolor=lightblue style=width:700px>");

[Link]("<tr><th>ProductName</th><th>Quantity</th><th>UnitPrice</th><th>TotalC
ost</th></tr>");
[Link]("<tr><th>"+productName+"</th><th>"+quantity+"</th><th>"+unitprice+"</th
><th>"+totalCost+"</th></tr>");
[Link]("</table>");
[Link]("</body></html>");
}
}
Output:

You might also like