com.smartgwt.client.docs
Interface SpringIntegration


public interface SpringIntegration

Overview

The Spring framework has many different parts, from integration with Object Relational Mapping (ORM) and transaction management systems, to a Model View Controller (MVC) architecture.

If you are building a new application from scratch and/or you are trying to modernize the presentation layer of an existing application, most of Spring MVC is inapplicable in the 'SmartGWT architecture'. Specifically, SmartGWT renders all HTML on the client, and the server is responsible only for retrieving data and enforcing business rules. This means that Spring's ModelAndView and all functionality related to retrieving and rendering Views is unnecessary in SmartGWT. SmartGWT only needs the Model, and provides methods to deliver that Model to SmartGWT components (the server side method DSResponse.setData()).

However, Spring's DispatchServlet, Handler chain, and Controller architecture is applicable to SmartGWT. See "Using Spring Controllers" below.

Existing Spring Application

As discussed under the general 'server integration' topic, integrating SmartGWT into your application involves finding a way to provide data that fulfills the DSRequest sent by SmartGWT components.

There are 2 approaches for integrating SmartGWT into an existing Spring application:

Using Spring Controllers with SmartGWT DMI

You can create a Controller that invokes standard SmartGWT server request processing, including DMI, like so:

 public class SmartGWTRPCController extends AbstractController
 {
     public ModelAndView handleRequest(HttpServletRequest request, 
                                       HttpServletResponse response)
         throws Exception
     {
         // invoke SmartGWT server standard request processing
         com.isomorphic.rpc.RPCManager.processRequest(request, response);
         return null; // avoid default rendering
     }
 }
 
This lets you use Spring's DispatchServlet, Handler chain and Controller architecture as a pre- and post-processing model wrapped around SmartGWT DMI.