com.softslate.commerce.customer.product
Class ProductAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by com.softslate.commerce.customer.core.BaseAction
          extended by com.softslate.commerce.customer.product.ProductAction

public class ProductAction
extends BaseAction

Struts action class that corresponds to the product page. Used for requests to "/Product.do".

The execute method of this class populates a product's information from the database and puts it in the request scope for use by the view layer. Given a ProductForm with its code property populated, it creates and initializes an instance of Product. It then invokes ProductProcessor.getProductFromCode(Product) to load the product's information from the database. It puts the initialized Product object in the request scope as an attribute with the names "productForm" and "product". A Map representing the product's custom settings and other settings is also placed in the request scope as an attribute named "productSettings".

The execute method next loads a Map of attribute-only SKUs and places it in the request as an attribute named "attributeSKUs" so they may be displayed on the product page. (Attribute-only SKUs are SKUs which are not tied to any particular product but which may still be relevant to the product being displayed.)

Next, the execute method determines the user's "current category" for purposes of breadcrumbing and places it in a session attribute named "currentCategory", holding the code property of the user's current category. If the user has clicked a link from a category page to arrive at the product page, a request parameter named "category" is used. Otherwise, for example if the user has arrived from the search results page or some other source, the product's primaryCategory is used. The current category determines what category appears above the product in the breadcrumbing links, as well as what category is highlighted in the category tree.

Finally, three other request attributes are set from the product's data. Each of these variables is initialized with default values in BaseRequestProcessor.processPreprocess(HttpServletRequest, HttpServletResponse) and altered here with product-specific data:

Author:
David Tobey
See Also:
ProductForm, Product, ProductProcessor

Field Summary
(package private) static org.apache.commons.logging.Log log
           
 
Fields inherited from class org.apache.struts.action.Action
servlet
 
Constructor Summary
ProductAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.commons.logging.Log log
Constructor Detail

ProductAction

public ProductAction()
Method Detail

execute

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
                                                      org.apache.struts.action.ActionForm form,
                                                      javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response)
                                               throws java.lang.Exception
Overrides:
execute in class org.apache.struts.action.Action
Throws:
java.lang.Exception


Copyright © SoftSlate, LLC 2003–2005