Command types

WebSphere Commerce commands are Java beans that contain the programming logic associated with handling a particular request. Commands perform a specific business process, such as adding a product to the shopping cart, processing an order, updating a customer's address book, or displaying a specific product page.

Depending on its nature, a command can:

The WebSphere Commerce programming model defines the following command types:

When creating new business logic for our e-commerce application, it is expected that we might need to create new controller and task commands.

New commands must implement their corresponding interface (which, in turn, should extend an existing interface). To simplify command writing, WebSphere Commerce includes an abstract implementation class for each type of command. New commands should extend these classes.

The following table shows which implementation class a new command should extend and which interface it should implement:

Command type Example command name Extends Implements example interface
Controller command MyControllerCmdImpl com.ibm.commerce.command.ControllerCommandImpl MyControllerCmd
Task command MyTaskCmdImpl com.ibm.commerce.command.TaskCommandImpl MyTaskCmd
Data bean command MyDataBeanCmdImpl com.ibm.commerce.command.DataBeanCommandImpl MyDataBean


Default commands and views

WebSphere Commerce provides default commands and views which we can use in the store. These default commands and views are listed in the Struts configuration file for the Web application.

Additionally, many of the views used in starter store were created specifically for the store. These views are listed in the struts-config-update.tpl.xml file packaged as part of the store archives. If a required command or view is not provided, we can add our own to the store archive's Struts configuration file.


Related concepts
Quantity units
Command context
Long-running controller commands
Data bean commands
Temporary changes to contextual information for URLs
WebSphere Commerce functional overview
Task command programming model
Pervasive computing
Pervasive computing flow
Formatting of input properties to views
Database commits and rollbacks for controller commands
WebSphere Commerce framework overview


Related tasks
Enable WebSphere Commerce components