Commands

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 may do any of the following:

There are four types of WebSphere Commerce commands.

Controller commands
Interact directly with a Web controller. Controller commands are targetable. On completion, a controller command returns the name of the view task to be executed. The Web controller determines the correct implementation class of the view command and then invokes it.
Task commands
Implement a specific application logic. Together, a controller command and a set of task commands usually implement the application logic for a URL request. A task command is not targetable, as it is always executed in the same container as the controller command.
Data bean commands
Are associated with a data bean and invoked by a JSP file when a data bean is to be instantiated. Data is populated into a data bean from a persistent object.
View commands
Respond to client requests by composing a view. View commands function in two ways: first, when a controller command specifies a view name upon successful completion of the request, and second, when a command detects an error, and then throws an exception with a view command name. When the exception propagates to the Web controller, it executes the view command and sends the response back to the client. There are three types of view commands.
  • Redirect view commands send the view using a redirect protocol, such as a URL redirection. When a reload key is entered, the redirected URL will be executed instead of the original URL.
  • Direct view commands send the response view directly to the client.
  • Forward view commands send the response view directly to another Web component, such as a JSP file.

Commands are associated with the CMDREG, URLREG, and VIEWREG database tables.