Create a dynamic Web application with AJAX
This tutorial demonstrates how to expose a server-side method to an AJAX-enabled client application. You will use the WAS Feature Pack for Web 2.0, RPC Adapter technology to expose a method in a Java class that returns a list of movie data. You will use the Dojo Toolkit, included in the WAS Feature Pack for Web 2.0, to create the Web page that will display the movie data.
Learning objectives
The purpose of this tutorial is to teach you how you can use the RPC Adapter to create a command-based service to an AJAX-based user interface. In this tutorial you will learn how to:
- Create a Web 2.0 enabled Web application to contain all of the resources required by your application.
- Create the RPC Adapter service that returns a JSON response.
- Create the Java objects that contain the data for your application.
- Create a Web page that is Dojo enabled.
- Write JavaScriptâ„¢ and HTML code to create the AJAX-based user interface for your application
Time required
This tutorial should take approximately 60 minutes to finish. If you explore other concepts related to this tutorial, it could take longer to complete.
Prerequisite
Install WAS Version 7.0:
- Open the IBM Installation Manager.
- Click Install. The Install Packages page opens.
- In the package list, select IBM WAS Version 7.0 Test Environment, then click Next.
- Read the license agreements. Accept the license agreements then click Next.
- Follow the instructions in the Installation Manager to install WAS Version 7.0.
- In the Features list, ensure that you select IBM WAS Version 7.0 Feature Packs. These feature packs include the WAS Feature Pack for Web 2.0.
Tip: You can also run this tutorial using WAS Versions 6.0 and 6.1. If you use WAS Version 6.0 or 6.1, ensure that you also install the feature packs. The instructions in this tutorial assume that you are using WAS Version 7.0. The instructions will vary if you use a different test environment.
Lessons in this tutorial
- Lesson 1: Create a Web project
In this lesson, you will learn to create a Web project that is configured for Web 2.0 application development by enabling specific project facets.- Lesson 2: Create server side Java classes
In this lesson you will learn to create the server side Java classes that will hold the data for the application.- Lesson 3: Expose the RPC Adapter Service
In this lesson you will learn how to create the RPC Adapter service that returns a JSON response.- Lesson 4: Create the Dojo client
In this lesson you will enable the Web page that you created earlier for Dojo development.- Lesson 5: Script the data grid
Now that you have declared the grid, you can write the necessary JavaScript that loads the data from our MovieService Java object, and to bind that data to the grid.- Lesson 6: Create the details pane
In this lesson, you will create a details pane that displays the properties of a Movie object when it is selected in the Master table.