Before you start
The current trend in online shopping has retailers targeting customers wherever they are, whichever device they are on, rather than being restricted to a traditional desktop. You will go through one implementation of WebSphere Commerce specifically for a mobile device. This tutorial highlights many of the key concepts of how to use the WebSphere Commerce Struts framework to support different displays for each mobile device. You will learn to implement a servlet filter to detect each device and then map it accordingly to a new Struts action. You will also force the display type based on your preference. Finally, you will learn how to cache the pages based on the device format.
- Implement a servlet filter to detect the type of device submitting the request.
- Create views for specific devices.
- Switch between mobile and non-mobile views on the storefront.
- Use Dynacache to cache the views based on device type.
This tutorial is intended for WebSphere Commerce developers. Knowledge of Struts, strorefront JSPs, and servlet filters is useful, but not required.
This tutorial requires the use of a mobile device simulator to test the results. You will need to find a simulator, for example, by searching for one via the Internet. We used an Apple® iPhone® simulator in our practice. The assumption is that the simulator allows you to enter a URL from the local server. This tutorial will provide the URLs to enter into the mobile device simulator.
This tutorial will also assume an IBM WebSphere Commerce Developer v6.0 environment is being used. There is no dependent fixpack or feature pack level.
The out-of-the box ConsumerDirect sample store is used throughout the tutorial.
Extract the provided MobileCommerceCode.zip to a temporary location because you will reference this location as MobileCommerceCode\ from now on.