Overview

Plants By WebSphere is among a number of samples that are provided with the IBM WebSphere Application Server Feature Pack for Web 2.0. The application is based on the orginal Plants By WebSphere application that is provided with the IBM WebSphere Application Server product. The Ajax version is meant to exemplfy a typical J2EE application and how it can be enhanced with an Ajax styled architecture without rewriting the entire application. The sample application represents a fictitious online Plant store where one can order and purchase flowers, trees, vegetables, and 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.

The application serves as an example of a web application that someone might attempt to develop. This application contains model, presentation, and controller layers that can be developed. Additionally, Ajax-style architecture is added through the JavaScript Dojo Toolkit. Specifically, the use of various Dojo widgets and enablement of drag-and-drop capabilities for the shopping cart are added. Figure 1.0 illustrates some of the features of the PlantsByWebSphere application.

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 the 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. Figure 2.0 shows the general components discussed previously.

Server Side

The PlantsByWebSphere application also includes an additional adapter layer using the Remote Procedure Call Adapter (RPCAdapter) which is provided with the Web 2.0 Feature Pack. The RPCAdapter library can be 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. Refer to the RPCAdapter documentation included with the Web 2.0 Feature Pack for additional details. In the case of Plants By WebSphere, 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.

Additional information on the Plants By WebSphere application and the IBM WebSphere Application Server Feature Pack for Web 2.0 can be found on IBM's developerWorks. Listed below are two examples: