Results 1 to 2 of 2

Thread: Please hELP ME!!!

  1. #1
    Join Date
    Jun 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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);
    }
    }

    %>

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •