com.softslate.commerce.customer.product
Class CategoryAction
java.lang.Object
org.apache.struts.action.Action
com.softslate.commerce.customer.core.BaseAction
com.softslate.commerce.customer.product.CategoryAction
public class CategoryAction
- extends BaseAction
Struts action class that corresponds to the category page. Used for requests
to "/Category.do".
The execute
method of this class populates a category's
information from the database and puts it in the request and session scopes
for use by the view layer. Given a
CategoryForm
with its
code
property populated, it creates and initializes an
instance of Category
.
It then invokes
ProductProcessor.getCategoryFromCode(Category)
to load the category's information from the database.
In the default implementation, in addition to all of the category's regular
properties, its productListCollection
is populated with just
those Product
s falling on the current page being displayed.
The paging parameter for the number of items to display comes from the
"categoryPageSize" setting in the sscSetting
database table.
Which page to display is determined by the value of the firstRow
request parameter (which is held by the incoming CategoryForm
and copied to the Category
object being populated).
This method puts the initialized Category
object in the
request and session scopes as an attribute with the name "currentCategory". A
Map
representing the category's custom settings and other
settings is also placed in the request and session scopes as an attribute
named "categorySettings".
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 one of the category's products.)
Finally, three other request attributes are set from the category's data.
Each of these variables is initialized with default values in
BaseRequestProcessor.processPreprocess(HttpServletRequest, HttpServletResponse)
and altered here with category-specific data:
htmlHeadTitle
: The category's name
is
appended to this value (which is initialized with the storeName
setting from the sscSetting
database table). By default this
variable is used in the <title> tag of the html header.
htmlHeadKeywords
: This value is replaced with the
category's keywords
property. By default this variable is used
in the <meta>/keywords tag of the html header.
htmlHeadDescription
: This value is replaced with the
category's description
property. By default this variable is
used in the <meta>/description tag of the html header.
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.
- Author:
- David Tobey
- See Also:
CategoryForm
,
Category
,
ProductProcessor
Field Summary |
(package private) static org.apache.commons.logging.Log |
log
|
Fields inherited from class org.apache.struts.action.Action |
defaultLocale, servlet |
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 |
log
static org.apache.commons.logging.Log log
CategoryAction
public CategoryAction()
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