View Single Post
  #3 (permalink)  
Old January 22nd, 2004, 01:49 AM
anees81 anees81 is offline
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No martyn i did try that but that did't solved my problem.
ok this is my action class code:

package Classes;

import java.util.logging.Logger;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class AddBookAction extends Action
{
  public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,HttpServletResponse response)
        {
          ServletContext ctx = servlet.getServletContext();
          Catalog catalog = (Catalog)ctx.getAttribute("catalog");
          ShoppingCart cart = (ShoppingCart)form;
          int book = Integer.parseInt(request.getParameter("index"));
          cart.addBook((Book)catalog.get(book));
          return mapping.findForward("success");

          }

}


Regards:

Anees

Reply With Quote