Class ProductAction

  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 "/".

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:

An instance of CartDiscountProcessor is also instantiated and place in the request scope as an attribute named "cartDiscountProcessor", to help in the display of discounts applicable to the user.

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
defaultLocale, servlet
Constructor Summary
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, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, 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


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


public ProductAction()
Method Detail


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
execute in class org.apache.struts.action.Action

Copyright ? SoftSlate, LLC 2003?2005