Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Naga
jsp
1 Answer(s)      4 years and 5 months ago
Posted in : JSP-Servlet


Hi,
I need solution this program.
In cart.jsp I printed the total amount of the products then the next page is shipping and billing details and the next page is payment details. What is need is the total amount which is in the cart.jsp should be printed on the textbox of the payment.jsp page and also calculate the tax payment and shipping amount should be added to the amount and the total amount should be printed on the Net payment text box in the payment.jsp page.
And these total amount and shipping details should be stored in ?orders? table in the ?shopping ? data base with the date because when the admin want to display the details from particular date to some other date.

If possible the text boxes in the payment.jsp (cart amount, tax amount, shipping, net payment) page modify to labels so no one change the details of the amounts in that text boxes.
Please help me
Thanx in advance..

Cart.jsp
<%@ page language="java" import="java.sql.*,java.io.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Cart Page </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">

<script language="javascript">
window.onload=function ()
{
var now=new Date();

document.forms[document.forms.length-1].rcf_date.value = now;//.toGMTString();
arr = new Array();
arr1=new Array();

var input = document.getElementsByName('quan');
for ( i = 0; i < input.length; i++ )
{
if ( input[i].type == 'text' )
{
arr.push( input[i] );
}
}
var input1 = document.getElementsByName('am');
for ( i = 0; i < input1.length; i++ )
{
if ( input1[i].type == 'hidden' ) {
arr1.push(input1[i]);
}
}
var sum=0;

var lab = document.getElementById('amt1');


for(i=0;i<arr.length;i++)
{

sum=sum+Number(arr[i].value)*Number(arr1[i].value);
lab.innerHTML = sum;

}
}
function call_1(id)
{

window.location.replace("./DcartServlet?id="+id);


}

function Value()
{

arr = new Array();
arr1=new Array();

var input = document.getElementsByName('quan');
for ( i = 0; i < input.length; i++ )
{
if ( input[i].type == 'text' )
{
arr.push( input[i] );
}
}
var input1 = document.getElementsByName('am');
for ( i = 0; i < input1.length; i++ )
{
if ( input1[i].type == 'hidden' ) {
arr1.push(input1[i]);
}
}
var sum=0;
var labels=document.getElementsByName("amt");
var lab = document.getElementById('amt1');
for(i=0;i<arr.length;i++)
{

labels[i].innerHTML=(arr[i].value)*(arr1[i].value);

}

for(i=0;i<arr.length;i++)
{

sum=sum+Number(arr[i].value)*Number(arr1[i].value);
lab.innerHTML = sum;
f1.amt2.value=sum;
//alert(f1.amt2.value);
}
}

</script>

</HEAD>

<form name="f1" action="shipping.html">
<BODY>
<table border=0>
<tr><td><img src="./images/shoppingcart.jpg" width="680" height="170"></td>
<td><table border=0>
<tr><td align="right"><a href="user_login.jsp" style="text-decoration: none; border-bottom: 1px solid #FFFFFF">Login</a></td></tr>
<tr><td><img src="./images/cooltext75055321.gif" width="300" height="65"></td></tr>
<tr><td><img src="./images/images6.jpg" width="300" height="75"></td></tr></table>
</table>
<img src="./images/5.jpg" width="990" height="5"><br>
<table align="center" border=0>
<tr><td><a href="home.html" style="color: #FFFFFF"><img src="./images/home.png" height=40></a></td>
<td><a href="admin_login.jsp" style="color: #FFFFFF"><img src="./images/admin.png" height=40></td>
<td><a href="gallery.jsp" style="color: #FFFFFF"><img src="./images/gallery.png" height=40></td>
<td><a href="sitemap.html" style="color: #FFFFFF"><img src="./images/sitemap.png" height=40></td>
<td><a href="aboutus.html" style="color: #FFFFFF"><img src="./images/aboutus.png" height=40></td>
<td><a href="contactus.html" style="color: #FFFFFF"><img src="./images/contactus.png" height=40></td></tr>
</table >
<img src="./images/5.jpg" width="990" height="5"><br>
<table border=1>
<tr><td align="left">Wel-Come <B><I><font color="Orange">Guest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></b></i></td>
<td>
<input type=text size="33" name="rcf_date">
<label name="new_date"></label>
</td><tr>
</table>
<table border=1>
<tr>
<td><table><tr> <td span=2 align="center"><b><font color="orange">Papular Category</font></b></td></tr><tr><td><img src="./images/kids1.jpg" width=75 height=50><img src="./images/Womens1.jpg" width=75 height=50></td><td> </td></tr>
<tr><td><img src="./images/trousers.jpg" width=75 height=50><img src="./images/SWeekend-Assortment.jpg" width=75 height=50></td><td></td></tr>
<tr><td span=2 align="right">More....</td></tr></table>
<table><tr> <td span=2 align="center"><b><font color="orange">Papular Brands</font></b></td></tr><tr><td><img src="./images/Nike_Shoes_Nz.jpg" width=75 height=50><img src="./images/nokia_n98.jpg" width=75 height=50></td><td> </td></tr>
<tr><td><img src="./images/raymond.gif" width=75 height=50><img src="./images/mayur.gif" width=75 height=50></td><td></td></tr>
<tr><td span=2 align="right">More....</td></tr></table>
<table><tr><td><img src="./images/verticalimg.gif"></td></tr></table>
</td>
<td>

<table border=1 width=658>
<tbody>
<td bgColor="#008080" width="47" align="center" height="19"><font color="#ffffff"><b>Sr No</b></font></td>
<td align="center" bgColor="#008080" width="107" height="19"><font color="#ffffff"><b>Product</b></font></td>
<td align="center" bgColor="#008080" width="224" height="19"><font color="#ffffff"><b>Price</b></font></td>
<td align="center" bgColor="#008080" width="270" height="19"><font color="#ffffff"><b>Quantity</b></font></td>
<td align="center" bgColor="#008080" width="270" height="19"><font color="#ffffff"><b>Amount</b></font></td>

<td align="center" bgColor="#008080" width="270" height="19"><font color="#ffffff"><b>Delete</b></font></td>


<%
Class.forName("com.mysql.jdbc.Driver").newInstance();

int i=1;
Connection con=null;
ResultSet rst=null;
Statement stmt=null;
PrintWriter pw=response.getWriter();
String id=request.getParameter("id");
try
{
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/shopping","root","password");
stmt=con.createStatement();
rst=stmt.executeQuery("select * from product where id='"+id+"'");
while(rst.next())
{
String m1=rst.getString(1);
String m2=rst.getString(2);
String m3=rst.getString(3);
String m4=rst.getString(4);
String m5=rst.getString(5);
String m6=rst.getString(6);
String m7=rst.getString(7);
String m8=rst.getString(8);
String m9=rst.getString(9);
int a=stmt.executeUpdate("insert into cart values('"+m1+"','"+m2+"','"+m3+"','"+m4+"','"+m5+"','"+m6+"','"+m7+"','"+m8+"','"+m9+"')");
}
rst=stmt.executeQuery("select * from cart");
while(rst.next())
{

if (i==(i/2)*2){
%>
<tr>
<td align="center" bgColor="#ffff98"><%=i%></td>
<td align="center" bgColor="#ffff98"><img src="./images/<%=rst.getString(9)%>" width="100" height="100"></td>
<td align="center" bgColor="#ffff98">$<%=rst.getString(7)%></td>
<td align="center" bgColor="#ffff98"><input id="text1" type="text" name="quan" value="1"> </td>
<td align="center" bgColor="#ffff98">$<input type="hidden" name="am" id="am" value="<%=rst.getString(7)%>"><label id="amt" name="amt"><%=rst.getString(7)%></label> </td>
<td align="center" bgColor="#ffff98"><img src="./images/delete.png" width="25" height="25" onclick='call_1(<%=rst.getString(1)%>);'></td> &nbsp;&nbsp;
</tr>
<%
}
else{
%>
<tr>
<td align="center" bgColor="#ffcc68"><%=i%></td>
<td align="center" bgColor="#ffcc68"><img src="./images/<%=rst.getString(9)%>" width="100" height="100"></td>
<td align="center" bgColor="#ffcc68">$<%=rst.getString(7)%></td>
<td align="center" bgColor="#ffcc68"><input id="text1" type="text" name="quan" value="1"> </td>
<td align="center" bgColor="#ffcc68">$<input type="hidden" name="am" id="am" value="<%=rst.getString(7)%>"><label id="amt" name="amt"><%=rst.getString(7)%></label> </td>
<td align="center" bgColor="#ffcc68"><img src="./images/delete.png" width="25" height="25" onclick='call_1(<%=rst.getString(1)%>);'></td> &nbsp;&nbsp;</tr>


<% }
i++;
}
rst.close();
stmt.close();
con.close();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
%>
<tr><td></td><td></td><td></td><td align="right">Grand Total:</td><td align="center">$<label id="amt1" name="amt1"></label><input type="hidden" name="amt2"></td></tr>
</table>
<table align="center">
<tr>
<td align="center"colspan=2><input type="button" onClick="Value()" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Update Cart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></td>
<td align="center"colspan=2><input type="submit" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Check Out &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" ></td>
<td align="center"colspan=2><a href="./home.html" style="color:#ffffff"><input type="button" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Continue shopping &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" ></a></td>
</tr>
</table>
</td>
<td align="right"><img src="./images/verticalad.gif">
</td>
</tr>
</tbody>
</table>
</BODY>
</form>
</HTML>

Shipping.jsp

<%@ page language="java" import="java.sql.*,java.io.*"%>
<html>
<head>
<title>Shipping and Billing page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">

window.onload=function ()
{
var now=new Date();

document.forms[document.forms.length-1].rcf_date.value = now;//.toGMTString();
}
function same()
{
//if(f1.c1.checked==true)
//{

f1.fname1.value=f1.fname.value;
f1.lname1.value=f1.lname.value;
f1.email1.value=f1.email.value;
if(f1.g[0].checked==true)
f1.g1[0].checked=true;
else if(f1.g[1].checked==true)
f1.g1[1].checked=true;
f1.cno1.value=f1.cno.value;
f1.add1.value=f1.add.value;
f1.country1.value=f1.country.value;

f1.state1.value=f1.state.value;
f1.city1.value=f1.city.value;
f1.gender1.value=f1.gender.value;



//}
}

</script>
</head>
<body>
<form name="f1" action="payment.jsp">

<table border=0>
<tr><td><img src="./images/shoppingcart.jpg" width="680" height="170"></td>
<td><table border=0>
<tr><td align="right"><a href="user_login.jsp" style="text-decoration: none; border-bottom: 1px solid #FFFFFF">Login</a></td></tr>
<tr><td><img src="./images/cooltext.gif" width="300" height="65"></td></tr>
<tr><td><img src="./images/images6.jpg" width="300" height="75"></td></tr></table>
</table>
<img src="./images/5.jpg" width="990" height="5"><br>
<table align="center" border=0>
<tr><td><a href="home.html" style="color: #FFFFFF"><img src="./images/home.png" height=40></a></td>
<td><a href="admin_login.jsp" style="color: #FFFFFF"><img src="./images/admin.png" height=40></td>
<td><a href="gallery.jsp" style="color: #FFFFFF"><img src="./images/gallery.png" height=40></td>
<td><a href="sitemap.html" style="color: #FFFFFF"><img src="./images/sitemap.png" height=40></td>
<td><a href="aboutus.html" style="color: #FFFFFF"><img src="./images/aboutus.png" height=40></td>
<td><a href="contactus.html" style="color: #FFFFFF"><img src="./images/contactus.png" height=40></td></tr>
</table >
<img src="./images/5.jpg" width="990" height="5"><br>
<table border=1 width=990>
<tr><td align="left" width=5555>Wel-Come to <B><I><font color="Orange">SHOPPING CART</font></b></i></td>
<td>
<input type=text size="33" name="rcf_date">
</td><tr>
</table>

<table border=1>
<tr>
<td><table><tr> <td span=2 align="center"><b><font color="orange">Papular Category</font></b></td></tr><tr><td><img src="./images/kids1.jpg" width=75 height=50><img src="./images/Womens1.jpg" width=75 height=50></td><td> </td></tr>
<tr><td><img src="./images/trousers.jpg" width=75 height=50><img src="./images/SWeekend-Assortment.jpg" width=75 height=50></td><td></td></tr>
<tr><td span=2 align="right">More....</td></tr></table>
<table><tr> <td span=2 align="center"><b><font color="orange">Papular Brands</font></b></td></tr><tr><td><img src="./images/Nike_Shoes_Nz.jpg" width=75 height=50><img src="./images/nokia_n98.jpg" width=75 height=50></td><td> </td></tr>
<tr><td><img src="./images/raymond.gif" width=75 height=50><img src="./images/mayur.gif" width=75 height=50></td><td></td></tr>
<tr><td span=2 align="right">More....</td></tr></table>
<table><tr><td><img src="./images/verticalimg.gif"></td></tr></table>
</td>
<td>
<table width=559 border="0" >
<tr align="center">
<th colspan="2" valign="bottom"><h4>
<span style="color: #0066ff">
Shipping and Billing Details</span></h4></th>
</tr>

<tr>
<td>
<table width=641 border="0">
<tr align="center">
<td colspan="2" style="color:Blue; font-size:larger; height: 22px;">
Shipping Details</td><td colspan="2" style="color:Blue; font-size:larger">
Billing Details</td>
</tr>
<tr>
<td>
<input type="checkbox" name="c1">Edit Shipping Details </td><td></td>
<td><input type="checkbox" name="c2" onClick="same()">Same as Shipping Details </td><td></td>
</tr>
<tr>
<td style="height: 26px" align="center">
First Name:</td>
<td style="height: 26px">
<input type="text" name="fname">
</td>
<td style="height: 26px" align="center">
First Name:</td>
<td style="height: 26px">
<input type="text" name="fname1">
</td>
</tr>
<tr>
<td style="height: 26px" align="center">
Last Name:</td>
<td style="height: 26px">
<input type="text" name="lname">
</td>
<td style="height: 26px" align="center">
Last Name:</td>
<td style="height: 26px">
<input type="text" name="lname1">
</td>
</tr>
<tr>
<td align="center">
Email Id:</td>
<td>
<input type="text" name="email">
</td>
<td align="center">
Email Id:</td>
<td>
<input type="text" name="email1">

</td>
</tr>
<tr>
<td align="center"> Gender:</td>
<td> <input type="radio" name="g">Male
<input type="radio" name="g">Female
</td>
<td align="center"> Gender:</td>
<td> <input type="radio" name="g1">Male
<input type="radio" name="g1">Female
</td>
</tr>
<tr>
<td style="height: 26px" align="center">
Contact No.:</td>
<td style="height: 26px">
<input type="text" name="cno"></td>
<td style="height: 26px" align="center">
Contact No.:</td>
<td style="height: 26px">
<input type="text" name="cno1"></td>
</tr>
<tr>
<td align="center">
Address:</td>
<td>
<textarea name="add" cols="15"></textarea>
</td>
<td align="center">
Address:</td>
<td>
<textarea name="add1" cols="15"></textarea>
</td>
</tr>
<tr>
<td align="center">
Country:</td>
<td>
<select name="country">
<option>America</option>
<option>Bangladesh</option>
<option>china</option>
<option>India</option>
<option>Srilanka</option>
<option>Australia</option>
<option>Newzeland</option>
</select>
</td>
<td align="center">
Country:</td>
<td>
<select name="country1">
<option>America</option>
<option>Bangladesh</option>
<option>china</option>
<option>India</option>
<option>Srilanka</option>
<option>Australia</option>
<option>Newzeland</option>
</select>
</td>
</tr>
<tr>
<td align="center">
State:</td>
<td><select name="state">
<option>Andhra Pradesh</option>
<option>Delhi</option>
<option>Karnataka</option>
<option>Orisa</option>
<option>West Bengal</option>
<option>Madya Pradesh</option>
<option>Himachal Pradesh</option>
</select></td>
<td align="center">
State:</td>
<td><select name="state1">
<option>Andhra Pradesh</option>
<option>Delhi</option>
<option>Karnataka</option>
<option>Orisa</option>
<option>West Bengal</option>
<option>Madya Pradesh</option>
<option>Himachal Pradesh</option>
</select></td>
</tr>
<tr>
<td align="center">
City:</td>
<td><select name="city">
<option>Mumbai</option>
<option>Bangalore</option>
<option>Karnata</option>
<option>Bhuvaneshwar</option>
<option>Hyderabad</option>
<option>Secunderabad</option>
<option>Trivendrum</option>
</select></td>
</td>
<td align="center">
City:</td>
<td><select name="city1">
<option>Mumbai</option>
<option>Bangalore</option>
<option>Karnata</option>
<option>Bhuvaneshwar</option>
<option>Hyderabad</option>
<option>Secunderabad</option>
<option>Trivendrum</option>
</select></td>
</td>
</tr>
</table>
&nbsp;
</td>


<td>
</td> </tr>
<tr align="center">
<td colspan="2" style="height: 26px">
<input type="Submit" value="Proceed to Payment" /> </td>
</tr></table>
</td>
<td><img src="./images/verticalad.gif">
</td>
</table>


</form>
</body>
</html>


Payment.jsp
<%@ page language="java" import="java.sql.*,java.io.*"%>
<html>
<head>
<title>Payment page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">

window.onload=function ()
{
var now=new Date();

document.forms[document.forms.length-1].rcf_date.value = now;//.toGMTString();
}

</script>
</head>
<body>
<form name="f1" action="payment.jsp">

<table border=0>
<tr><td><img src="./images/shoppingcart.jpg" width="680" height="170"></td>
<td><table border=0>
<tr><td align="right"><a href="user_login.jsp" style="text-decoration: none; border-bottom: 1px solid #FFFFFF">Login</a></td></tr>
<tr><td><img src="./images/cooltext.gif" width="300" height="65"></td></tr>
<tr><td><img src="./images/images6.jpg" width="300" height="75"></td></tr></table>
</table>
<img src="./images/5.jpg" width="990" height="5"><br>
<table align="center" border=0>
<tr><td><a href="home.html" style="color: #FFFFFF"><img src="./images/home.png" height=40></a></td>
<td><a href="admin_login.jsp" style="color: #FFFFFF"><img src="./images/admin.png" height=40></td>
<td><a href="gallery.jsp" style="color: #FFFFFF"><img src="./images/gallery.png" height=40></td>
<td><a href="sitemap.html" style="color: #FFFFFF"><img src="./images/sitemap.png" height=40></td>
<td><a href="aboutus.html" style="color: #FFFFFF"><img src="./images/aboutus.png" height=40></td>
<td><a href="contactus.html" style="color: #FFFFFF"><img src="./images/contactus.png" height=40></td></tr>
</table >
<img src="./images/5.jpg" width="990" height="5"><br>
<table border=1 width=990>
<tr><td align="left" width=5555>Wel-Come to <B><I><font color="Orange">SHOPPING CART</font></b></i></td>
<td>
<input type=text size="33" name="rcf_date">
</td><tr>
</table>
<table border=1>
<tr>
<td><table><tr> <td span=2 align="center"><b><font color="orange">Papular Category</font></b></td></tr><tr><td><img src="./images/kids1.jpg" width=75 height=50><img src="./images/Womens1.jpg" width=75 height=50></td><td> </td></tr>
<tr><td><img src="./images/trousers.jpg" width=75 height=50><img src="./images/SWeekend-Assortment.jpg" width=75 height=50></td><td></td></tr>
<tr><td span=2 align="right">More....</td></tr></table>
<table><tr> <td span=2 align="center"><b><font color="orange">Papular Brands</font></b></td></tr><tr><td><img src="./images/Nike_Shoes_Nz.jpg" width=75 height=50><img src="./images/nokia_n98.jpg" width=75 height=50></td><td> </td></tr>
<tr><td><img src="./images/raymond.gif" width=75 height=50><img src="./images/mayur.gif" width=75 height=50></td><td></td></tr>
<tr><td span=2 align="right">More....</td></tr></table>
<table><tr><td><img src="./images/verticalimg.gif"></td></tr></table>
</td>
<td>


<table width="100%" id="TABLE1" border=0>
<tr>
<td style="width: auto" align="center" colspan="3">

<h2>Payment Details</h2>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<td>
<h3>Order Summary</h3>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>

<tr style="width: 100%">
<td align="center" style="width: 40%">
Cart Amount
</td>
<td>
<input type="text" name="camt" Width="225px" >
</td>
</tr>
<tr style="width: 100%">
<td align="center" style="width: 40%">
Tax Amount(8.5)
</td>
<td>
<input type="text" name="txtamt" Width="225px">
</td>
</tr>
<tr style="width: 100%">
<td align="center" style="width: 40%">
Shipping Amount
</td>
<td>
<input type="text" Width="223px" name="shipamt" value="$10">
</td>
</tr>
<tr style="width: 100%">
<td align="center" style="width: 40%; height: 26px;">
Net Payable Amount
</td>
<td style="height: 26px">
<input type="text" name="netamt" Width="225px" >
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<td>
Accepted Cards: Visa,MasterCard,American Express
</td>
<td>
<img src="./images/PayCards.gif">
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<td>
<h3>Enter card details</h3>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr style="width: 100%">
<td style="width: 40%" align="center">
Card Number
</td>
<td>

<input type="text" name="cardno">

</td>
<td>
Enter in format (1111-1111-1111-1111)
</td>
</tr>
<tr>
</tr>
<tr style="width: 100%">
<td style="width: 40%; height: 59px;" align="center">
Card Code
</td>
<td>
<input type="text" name="cardcode">

</td>
<td style="height: 59px">
(Valid CVV2,CVC2 or CID value,3 or 4 digit number on back of credit card for American
Express)
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr style="width: 100%">
<td style="width: 40%" align="center">
Expiry Date
</td>
<td>
<select name="month">EnterMonth
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select name="year">EnterYear
<option>2010</option>
<option>2011</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2015</option>
<option>2016</option>
<option>2017</option>
<option>2018</option>
<option>2019</option>
<option>2020</option>
<option>2021</option>
<option>2022</option>
<option>2023</option>
<option>2024</option>
<option>2025</option>
</select>
&nbsp;<br>&nbsp; mm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; yyyy</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="PAY NOW">

</td>
</tr>
</table>

</td>
<td><img src="./images/verticalad.gif">
</td>
</table>


</form>
</body>
</html>


Advertisement
View Answers

July 7, 2010 at 1:30 PM


Hi Friend,

1) Put <input type="hidden" name="cartamount" value="<%=request.getParameter("amt2")%>"> in the shipping.jsp.

2) Then retrieve it in payment.jsp with the following code:

<%String cartAmount=request.getParameter("cartamount");
double amount=Double.parseDouble(cartAmount);
double tax=8.5*amount;
double taxAmount=tax/100;
double deduc=taxAmount+10;
double net=amount-deduc;

%>

Put all these values in their respective text boxes.

<tr style="width: 100%">
<td align="center" style="width: 40%">
Cart Amount
</td>
<td>
<input type="text" name="camt" value="$<%=amount%>" Width="225px" disabled="true">
</td>
</tr>
<tr style="width: 100%">
<td align="center" style="width: 40%">
Tax Amount(8.5)
</td>
<td>
<input type="text" value="$<%=taxAmount%>" name="txtamt" Width="225px" disabled="true">
</td>
</tr>
<tr style="width: 100%">
<td align="center" style="width: 40%">
Shipping Amount
</td>
<td>
<input type="text" Width="223px" name="shipamt" value="$10" disabled="true">
</td>
</tr>
<tr style="width: 100%">
<td align="center" style="width: 40%; height: 26px;">
Net Payable Amount
</td>
<td style="height: 26px">
<input type="text" value="$<%=net%>" name="netamt" Width="225px" disabled="true" >
</td>
</tr>

Thanks


Related Tutorials/Questions & Answers:
jsp
jsp  how to include two jsp page
Jsp
Jsp  Can I implement interface in jsp
Advertisements
jsp
jsp  how to create jsp page
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  how jsp translated into servlets
JSP
what is JSP forward tag for  what is JSP forward tag for   It forwards the current request to another JSP page. Below is the syntax for the same:- <jsp:forward page="...url..." /> We can also forward parameter
jsp
jsp  write a code for jsp file generator to generate a jsp page automatically taking html page as input
jsp
jsp  how to create a table in oracle using jsp and the table name is entered in text feild of jsp page
JSP
JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java
jsp
jsp   what is the basic necessities reguired for running jsp using JDBC bridge?? and how to write a jsp code to access the detail present in microsoft access pls send link regarding above
jsp
jsp  how to connect the database with jsp using mysql   Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml
jsp
jsp  how to upload image through csv format in jsp
jsp
jsp  I Want complete note on JSP servlet
jsp
jsp  how to delete data from database using jsp
jsp
jsp  why jsp is translated into servlet?pls describe precisly
jsp
jsp  how to write a servlet and jsp program for user login form
jsp
jsp  how to include google map in our jsp page
JSP
JSP  FILE UPLOAD-DOWNLOAD code USING JSP
jsp
jsp  how to write hindi in jsp and store in database as unicode
jsp
jsp  code for jsp automatic genration using html
JSP
JSP  relevant difference between servlet and jsp in 1 line
jsp
jsp  how to pass jsp variable to an html page
jsp
jsp  how to write a servlet and jsp program for user login form
JSP
JSP   How to create CAPTCHA creation by using JSP? I need an code for CAPTCHA creation by using JSP...   You can create a captcha validation using jsp. Have a look at the following tutorial: Captcha Creation
JSP
What are JSP directives, page directives and include directives?  what are jsp directives? and what are page directives? and what are include directives? can you explain taglib directives?   JSP directives JSP
JSP
Can you explain jsp page life cycle what is el how does el search for an attribute in JSP  Can you explain jsp page life cycle what is el how does el...://www.roseindia.net/jsp/simple-jsp-example/LifeCycleOfJspPage.shtml http
JSP
JSP  what are the different scopes an object can have in a jsp page   JSP Scope Variables: Page scope-It makes the data available... the following links: http://www.roseindia.net/jsp/simple-jsp-example
JSP
what is jstl in JSP   what is jstl   JSTL is also called as JSP tag libraries. They are collection of custom actions which canbe accessed as JSP tags. For more information, visit the following link: JSTL Tutorials
JSP
access application data stored in JavaBeans components. The jsp expression...). Before JSP 2.0, we could use only a scriptlet, JSP expression, or a custom tag to include server state in the jsp page output. For more information, visit
JSP
JSP public opinion poll   Develop a JSP for a news channel to conduct public opinion poll on any topic. Users will respond through yes or no options. Later display the result in percentage
jsp
jsp  sir i want to jsp code for online examination like as bank po,,,,,,plz help me sir
 

 

 

DMCA.com