Plants by WebSphere details

This sample demonstrates Web 2.0 features in this product. The Plants by WebSphere sample application demonstrates Ajax-style architecture through the use of Dojo widgets.

The PlantsByWebSphere application is representative of a Web application that contains model, presentation, and control layers. The PlantsByWebSphere application is a fictional Web site that sells plants and gardening accessories. You can view an online catalog, select items, and add them to a cart. When the cart contains items, you can proceed to log in, supply credit card information, and checkout.

Ajax-style architecture is added through the JavaScript Dojo Toolkit. For the shopping cart, various Dojo widgets and drag-and-drop capabilities are added.

To support drag and drop, a number of Dojo widget controls were created. The widgets include support for displaying the inventory in a grid, displaying detail information on the items and dragging items to a shopping cart. When you click check out, the content of the shopping cart widget is sent to the server for processing. The grid widget that displays the content of the catalog derives the information by issuing a request to the server using dojo.xhr(Get,Put). The response from the server is sent back in XML format and contains detail information and a Universal Resource Locator (URL) reference to where the image is located.

Server side

The PlantsByWebSphere application also includes an additional adapter layer using the RPCAdapter. The RPCAdapter is used to map traditional J2EE constructs such as Enterprise Java Beans (EJBs), Web Services, and POJOs to lightweight constructs such JavaScript Object Notation (JSON) or XML data. The data can easily be consumed and rendered by JavaScript based clients using Dojo. The RPCAdapter is used to map client side GET requests to legacy EJB or Servlet session data. The data is returned as XML and used as input to construct the Dojo widgets within the Browser.


Feedback