Docsity

Order bulb using the servlet program, Assignments of Computer science

Toggle sidebar
bg1
Step 1: The XHTMI. code for inputting the values is
<ldoctype html>
<html>
<head>
<title> Order Fomm </title>
</head>
<body>
<form action="http:/localhost/examples/sorvlets/sorvlet/Order'>
<h3>Enter the Data</h3>
<table>
<tr>
<td>User Name: </td>
<td> <input type="text" name="UserName"></td>
</tr>
<tr>
<td>Items:</td>
</tr>
<tr>
<td> <input type="checkbox" name="option1">Four 100 Watt light bulbs for Rs.20</td>
<td> <input type="text" name="val1" size="2"> </td>
</tr
<tr>
<td> cinput type="checkbox"
name="option2">Eight 100 Watt light bulbs for Rs.40</td>
td> <input type="text" name="val2" size="2"> </td>
</tr>
<tr>
<td> <input type="checkbox"
name="option3">Four
pf3
pf4
pf5

Partial preview of the text

Download Order bulb using the servlet program and more Assignments Computer science in PDF only on Docsity!

Step 1: The XHTMI. code for inputting the values is

Order Fomm

Items:

Four 100 Watt light bulbs for Rs.20

cinput type="checkbox" name="option2">Eight 100 Watt light bulbs for Rs.40 td>

Four

100 Watt long life light bulbs for Rs.30 td>

Eight 100 Watt long life light bulbs for Rs.70 tr> td>

Str> td>Payment: /tr> tr> td> Visa

String str2=req.getParameter('val2"); Item2 =Integer.parselnt(str2); } ireq.getParameter('option3")| =null) {String str3=reqgetParameter("'val3"); Item3 =Integer.parselnt(str3); ifreq getParameter("'option4")| =null) String str4=req.getParameter('val4"); Item4=Integer.parselnt(str4); int total1=Item1 price1; int total2=Item2 price2; int total3=Item3 price3; int total4=Item4"price4; double total=(total1+total2+total3 +total4) total+=(total 2.0)/100; out.println""); out.printin(""); out.println("); out.printin(""): out.println("); out.println (User Name: "+UName); out.println ("You have ordered following items "); out.println("); outprintln('"); out printinl"Qty. "; out.println("Price"); out.println("Total"); out.println""); out.println(""); out.println(""+Item1+"";

out.printn(""+ price1+""); out.println(""+total1+""); out.println""); outprintn(""); out.println(""+Item2+""); out.println(""+price2+""); out.println(""+total2+""); out.println(""); out.println""); printn('"+Item3+""); out.println(""+price3+""); out.println(""+total3+""); out.println(""); out.println("") out.println(""+Item4+""); out.printn(""+price4+""); out.println(""+total4+""); out.println(""); out.println(" "); out.println("Total Bil(including Sales Tax of 2.0%) : "+total+" "); out.printn('"): out.printlin(""); } }