FileDocCategorySizeDatePackage
ProductAction.javaAPI DocExample1942Wed Apr 05 20:04:10 BST 2006com.oreilly.ajax

ProductAction

public class ProductAction extends org.apache.struts.action.Action

Fields Summary
static String
productsDirectory
Constructors Summary
Methods Summary
public org.apache.struts.action.ActionForwardexecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        ProductForm productForm = (ProductForm)form;
        String productName = productForm.getProductName();
        Product product = ProductManager.getProduct(productName);
        ProductManager.setImagePath(getFilePath());
        
        productForm.setDescription(product.getDescription());
        productForm.setFilename(product.getFilename());
        productForm.setPrice(product.getPrice());
        productForm.setImagePath(getFilePath()+"/"+product.getFilename());
        productForm.setProductId(product.getProductId());
            
            Properties properties = new Properties();
            FileInputStream in = null;

          String dir = properties.getProperty("products.directory");
          
        return mapping.findForward("success");
    
private java.lang.StringgetFilePath()

         
            String resourceFilepath = this.getServlet().getServletContext().getRealPath("/shopping.properties");
            Properties configs = new Properties();
            configs.load(new FileInputStream(resourceFilepath));
            return configs.getProperty("products.directory");