Tutorials > Program model


Next >


Tutorial: Modifying an existing controller command

Attention: This tutorial is currently under revision. The content might contain errors or inaccuracies. Subscribe to this page to be notified when an updated version is available.

This tutorial demonstrates how to modify an existing controller command. In this tutorial, we will restrict the number of items in a customer's shopping cart to five or fewer items.

To implement this solution, we will override the OrderItemAddCmdImpl class with the own implementation that includes logic to check for the number of items in the shopping cart. If a customer attempts to add a sixth item to the shopping cart, an exception is thrown. This exception uses a new error message.


Learning objectives

This tutorial is not meant to be an all encompassing example of restricting items in the shopping cart. The logic used in this tutorial is simplified.

After completing this tutorial we will be able to do the following tasks:


Time required

Expect this tutorial to take about 30 minutes to complete.

You can load the completed tutorial code instead of performing each step. After loading the completed tutorial code into the workspace, you can run the code as if you performed each step in the tutorial. However, in order to fully attain the learning objectives, it is recommended that you perform the tutorial step by step.


Audience

This tutorial is intended for WebSphere Commerce Store developers.


Prerequisites

Before starting this tutorial you should have a basic understanding of:

  1. Rational Application Developer.

  2. The Java programming language.

  3. The database type, Derby, DB2, iSeries, or Oracle, used in the WebSphere Commerce development environment.


Code prerequisites

If you completed other WebSphere Commerce programming tutorials, there is no harm in leaving the code in the workspace, as it will not conflict with this tutorial.

  1. Before starting this tutorial, have published a store based upon the consumer direct sample store within the development environment. Within this store, be able to complete a purchase (for example, browse the catalog, add items to the shopping cart, check out and see the order confirmation).

  2. In order to complete the deployment steps, the store must also exist on the target WebSphere Commerce Server.


Lessons in this tutorial

Next >


+

Search Tips   |   Advanced Search