-
Please hELP ME!!!
Hi to all, can anyone who knows what the following is about pls tell me. Thanks you very much!
<!-- 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);
}
}
%>
-
-
An interface to a server-side shopping cart program in Java Server Pages (JSP) - a way to reference Java classes and use their output from within a page.
String id to ("Sum"); gets various parameters and assigns them to variables.
If updatePressed exists (presumably updatePressed is sent to the page by form or another script when an "update" button is pressed) assume the button was clicked and call the appropriate method in the (previously referenced) Java object ("cart").
buttonPressed appears to be much the same as updatePressed, but from a "Delete" button, and again, the method is called in the server-side Java object to delete the item from wherever it's being stored.
Last edited by Twey; 06-30-2005 at 06:10 PM.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks