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



Home Answers Viewqa JSP-Servlet Unable to run the jsp page
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Naga
Unable to run the jsp page
3 Answer(s)      4 years and 3 months ago
Posted in : JSP-Servlet


Expert:Naga
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>

Answers
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




Below error is coming when executing the payment.jsp page



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /payment.jsp:56

53: <td>
54: <%
55: String cartAmount=request.getParameter("cartamount");
56: double amount=Double.parseDouble(cartAmount);
57: double tax=8.5*amount;
58: double taxAmount=tax/100;
59: double deduc=taxAmount+10;

Advertisement
View Answers

July 8, 2010 at 5:46 PM


Hi Friend,

1) Put the following code in the shipping.jsp:

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

and put the following code with the 'Proceed to Payment' button in shipping.jsp:

<input type="hidden" name="cartamount" value="<%=amount%>">
<input type="hidden" name="taxamount" value="<%=taxAmount%>"><input type="hidden" name="net" value="<%=net%>">

2)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>


July 8, 2010 at 5:47 PM


continue..

<table border=1>
<tr><td><table><tr> <td span=2 align="center"><b><font color="orange">Popular 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">Popular 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" value="$<%=request.getParameter("cartamount")%>" 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="$<%=request.getParameter("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="$<%=request.getParameter("net")%>" name="netamt" Width="225px" disabled="true"></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>


July 8, 2010 at 5:47 PM


continue..

<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>

Thanks


Related Tutorials/Questions & Answers:
Unable to run the jsp page - JSP-Servlet
Unable to run the jsp page  Expert:Naga Hi, I need solution... page is shipping and billing details and the next page is payment details. What... on the textbox of the payment.jsp page and also calculate the tax payment and shipping
Unable to execute JSP page
Unable to execute JSP page  I have written one jsp file. It contains html tags and jsp directives. I have saved the file with the extension .jsp... folder. But I could not execute the JSP page. Please help me
Advertisements
Unable to run jsp files on internet explorer - JSP-Servlet
Unable to run jsp files on internet explorer  Hi, I am Akhilesh Shrivastav. I am new to jsp and a new member of this site. My problem is i wrote...-tomcat-6.0.16/webapps/jsp i am sending simple program of jsp. Hello World JSP Page
unable to run servlet
unable to run servlet  Dear sir/madam i have jdk1.5.0_04 and tomcat...-mapping> 6)Compile your servlet. 7)Run Tomcat server by clicking... servlet. 7)Run Tomcat server by clicking the startup.bat file. This is located
How to run a simple jsp page in tomcat???
How to run a simple jsp page in tomcat???  i am trying to run a simple jsp page in tomcat,i am having web.xml also in WEB-INF folder. but it is giving me this error below....please help me to solve it. my jsp page code is given
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import="com.itextpdf.text.,com.itextpdf.text.pdf.,java.io.*;"%> </head>... to open the pdf file when i execute the jsp page
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import="com.itextpdf.text.,com.itextpdf.text.pdf.,java.io.*;"%> </head>... to open the pdf file when i execute the jsp page
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import="com.itextpdf.text.,com.itextpdf.text.pdf.,java.io.*;"%> </head>... to open the pdf file when i execute the jsp page
write data to a pdf file when i run jsp page
write data to a pdf file when i run jsp page  Hi, <%@page import="com.itextpdf.text.,com.itextpdf.text.pdf.,java.io.*;"%> </head>... to open the pdf file when i execute the jsp page
Unable to compile class for JSP - WebSevices
Unable to compile class for JSP  org.apache.jasper.JasperException: Unable to compile class for JSP When I am trying to access a java file kept under src folder under a package from a jsp page placed under web directory, I am
unable to connect to server - JSP-Servlet
unable to connect to server  thank you for the program code for inserting and reteriving the image but i am unable to deploy these two programs..., create a web application folder inside the webapps folder and put the jsp file
can i know the error in this code... am unable to run this code
can i know the error in this code... am unable to run this code  class DemoArray { public static void main(String args[]) { int arr[]={12,13,14,15}; int n=arr.lenght; System.out.println("length of array:"+n); for(int i=0;i
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..  I have a class file AbstractDataAccessObject with the below code.... If I use it also, unable to connect to backend oracle database. Let me
Unable to call .jrxml file from jsp
import="java.text.*" %> JSP Page...; ***And it output**** Here output display in browser. JSP Page...Unable to call .jrxml file from jsp  Hi, I am doing web application
run jsp file
run jsp file  how to run the jsp file in varies web servers  .... The jsp file is to be saved into the web application folder.Let the file... For more information on JSP visit to : JSP Tutorials Thanks
How to compile and run the JSP
How to compile and run the JSP  Hi Kindly tell me how to run and compile JSP small Program using Tomcat as webserver. I created small program HELLO JSP in HTML and compile the program but it is saying Class o r interface
Struts2...problem in JSP..unable to get the values for menuTitle!!!
Struts2...problem in JSP..unable to get the values for menuTitle!!!  ... Jsp is displaying the menuId from database but not the menuTitle...where as its...; </filter-mapping> </web-app> index.jsp : <%@ page
unable to compile class file - JSP-Servlet
unable to compile class file  I wrote database connection in jsp file. I have form in html. In html form i put drop down list box in that form...("/jsp/Combobox.jsp"); dispatcher.forward(request, response
JSP handle run-time exceptions
JSP handle run-time exceptions  How does JSP handle run-time exceptions?   You can use the errorPage attribute of the page directive... the browser to the JSP page error.jsp if an uncaught exception is encountered during
JSP run problem
JSP run problem  type Exception report message description... this request. exception org.apache.jasper.JasperException: Exception in JSP...) root cause java.lang.NullPointerException org.apache.jsp.bb_jsp
how to run jsp appication in eclipse
how to run jsp appication in eclipse  after setting the tomcat in eclipse, i m trying to run jsp page, but the pop up has come that "selection did not contain any resources that can run on server". plase tell me i m new to handle
Unable to bind to a hashmap from jsp using spring tags - Spring
Unable to bind to a hashmap from jsp using spring tags  Hi, I am unable to bind a hashmap from my jsp page. Here is what i want to do: I have an arraylist in a jsp page. As i loop through the array list, for each element i
how to run a .exe file in jsp
how to run a .exe file in jsp  i want code for to run a .exe file in jsp
how to run a vlc player in jsp
how to run a vlc player in jsp  how to run a vlc player in jsp
To run a jsp file automatically - IDE Questions
To run a jsp file automatically  Hi all, I am in need for the solution for - Can a JSP page can be made to run automatically when NetBeans IDE has been started. or we have to compile and run it automatically? I
how to deploy and run jsp - JSP-Servlet
how to deploy and run jsp  hi anybody plz tell how to deploy and run jsp. and where jsp and html files save in web-inf or any where?  Hi...- WEB-INF-classes | | root web.xml You save the jsp or html
how to run servlet - JSP-Servlet
how to run servlet  pls give me comlete procedure to run the servlet on apache-tomcat 6.0.16 how can i set my classpath, java_home etc. also where i have to save my servlet program and how it compile and then run on web browser
how to run jdbc in jsp program - JSP-Servlet
how to run jdbc in jsp program  i want to use sql server 2005 in jsp program to store data.i know how to run simple program but this program i tried... visit the following links: http://www.roseindia.net/jsp/submit-comments
Jsp error when i run this a jsp file
Jsp error when i run this a jsp file  hi I got this error when i run the jsp file in IDE and outside also please help me java.lang.NullPointerException org.apache.jsp.insertjsp.jspInit(insert_jsp.java:22
JSP and Servlet did not run - JSP-Servlet
JSP and Servlet did not run  I tried to run this program but when I... --------- Simple Use of Servlet and JSP... ---------- Registration Fee Page Thank you
platform(s/w requirements) for run jsp programs?
platform(s/w requirements) for run jsp programs?  in which platform jsp programms are run
 

 

 

DMCA.com