I'm new to ajax and like how it can do things asynchronously without having to reload the page. If I wanted to update my shopping cart total without having to actually hit the "update" button could it be done with the XMLHttpRequest object in this. Thanks for the help.
<% 
ShoppingCart cart = (ShoppingCart)session.getAttribute("cart");
if(cart==null){
response.sendRedirect("manageCart.jsp");
}else{
//We have the cart, let's update it
int itemCount = cart.getItemCount();
int quant = 0;
for(int i=itemCount-1; i>=0; i--){
    try{
        //User may have erased quantity or entered non-numeric value
        quant = new Integer(request.getParameter("item" + i)).intValue();
    }catch(NumberFormatException nfe){
        quant = 1;
    }
    //Get the next Item
    Item item = cart.getItem(i);
    //Set its quantity
    item.setQuantity(quant);
    if(request.getParameter("remove" + i)!=null){
        //Remove checkbox checked
        cart.removeItem(i);
    }
}
//Put the cart back in the session
session.setAttribute("cart",cart);
//go look at it!
response.sendRedirect("manageCart.jsp");
}
%>
 
    