Hi guys!!! Need your help urgently. Need to present later... Thanks a lot.\
<!-- Filename: ShoppingCart.jsp original version -->
<%@ page errorPage="errorpage.jsp" %>
<%@ page import="java.util.*" %>
<!-- Instantiate the Counter bean with an id of "counter" -->
<jsp:useBean id="cart" scope="session" class="database.ShoppingCart" />
<%
String id = request.getParameter("itemID");
String buttonPressed = request.getParameter("Submit");
String updatePressed = request.getParameter("input");
String quantity = request.getParameter("Sum");
if(id!=null){
if (updatePressed!=null){
cart.updateQuantity(id, Integer.parseInt(quantity));
}
if (buttonPressed!=null){
cart.removeItem(id);
}
}
%>
<html>
<head>
<title>Shopping Cart Contents</title>
</head>
<body>
<center>
<table width="300" border="1" cellspacing="0"
cellpadding="2" border="0">
<caption><b>Shopping Cart Contents</b></caption>
<body bgcolor= #CCCFFFF>
<tr>
<th>Description</th>
<th>Price</th>
<th>Quantity</th>
<th>Remove An Item</th>
<th>Update Quantity</th>
</tr>
<TR>
<%
Enumeration enum = cart.getEnumeration();
String[] tmpItem;
int numOfItems = 0;
// Iterate over the cart
while (enum.hasMoreElements()) {
%>
<form action="ShoppingCart.jsp" method="post">
<%
tmpItem = (String[])enum.nextElement();
numOfItems += Integer.parseInt(tmpItem[3]);
%> <tr>
<td><%=tmpItem[1] %></td>
<td align="center">$<%=tmpItem[2] %></td>
<td align="center"><%=tmpItem[3] %></td>
<td><input type="submit" name="Submit" value="Remove"></td>
<td><input type="text" name="Sum"><input type="Submit" name="input" value="update"></td>
<input type="hidden" name="itemID" value= "<%=tmpItem[0] %>" >
</form>
</tr>
<%
}
%>
</table>
</font><font color = "#000FFF">
<br> You are buying <%=cart.getNumOfItems() %> items.</br>
<br> Total coat is $<%=cart.getCost() %> </br>
<p align = "center">You have to pay $<%=cart.getCost() %>
</font><font color = "#CC0099">
</center>
<a href="AddToShoppingCart.jsp">Back to Catalog</a>
</body>
</html>
Can tell me briefly wat does this means specially those in bold cox dun understand...



Reply With Quote


Bookmarks