Related Topics: RIA Developer's Journal, Apache Web Server Journal, XML Magazine, AJAX World RIA Conference

RIA & Ajax: Article

AJAX and the Spring Framework with TIBCO General Interface

A Step by Step Look

Lets get started

Below we will show you how to get integrate GI with Spring's MVC.

Before we integrate with GI, we need to verify Spring in a 'stock' MVC/JSP environment. See the spring tutorial Spring MVC step by step. It's important that you understand this example because we will use this specific application as a basis for GI integration.

Our starting points are the latest and greatest versions of Spring, Xstream and GI. Our use case requires that we display a price list of products and modify the prices by entering a validated percentage the system will apply to all prices. Then, the price system will validate the percentage input and display error messages if the percentage is invalid.

Spring setup

Customizing build for your environment

Review the resources section below to see what components you will need to install on your system. At a minimum you will need Java (1.4.2 or higher), Ant (1.6.2), Spring (1.2.8) and Tomcat (5.5.x) and your favorite IDE. You'll also need to customize the and files for your environment. See the Spring MVC step by step tutorial and ensure you can view the JSP pages.

Spring Architecture

    •     Spring's View layer
    •     Spring configuration in detail

Take a look at the application context defined at src/main/Webapp/Web-INF/gi2spring-servlet.xml. Here we can see the two controllers established for the two actions (list products and increase products). Both have the product service (productManager) passed to them. The price increase controller also has a form and a validator associated with it. Note that the form and validator are POJOs (Plain Old Java Objects). There is no dependency between them and the Spring framework or JSP layer. Also defined here are the mapping between the controller names and the URLs. We made a change to the Spring example application controllers. We made the success view and form view values configurable as opposed to hardcoded. This is a best practice for Spring controllers in any event. It will become important shortly as we configure Spring to interoperate with GI.

Click for full-size image

One last configuration to examine is the view resolver

Click for full-size image

The view resolver is a plugin that tells Spring how to render the output from a controller. Here the view properties returned from the controller ("hello" and "priceincrease" ) get mapped to actual JSPs ("/Web-INF/jsp/hello.jsp" and "/Web-INF/jsp/priceincrease.jsp") . The view class is the component that in turn actually takes the output from the controller and renders it.

More Stories By Brian Walsh

Brian Walsh is the founder of, a Portland, Oregon consulting firm specializing in Internet and network-enabled product strategies and development. His areas of expertise include enterprise architecture, technical evaluations, infrastructure, software engineering and database design. Walsh's recent clients belong to a wide variety of industry segments; retail banking, insurance to telecos and network management firms. Always enjoying the hands-on approach, he divides his time between policy issues and technical challenges.

Comments (1)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.