Skip to content
Example of backing with Spring @MVC controllers
Latest commit 5f11403 Aug 16, 2011 @jeremyg484 Adding ITD's so that running opening Roo once is not required to buil…
…d the example. (Note that in a real project I probably wouldn't do this.)
Failed to load latest commit information.
.settings Full controller implementation to back example. Aug 2, 2011
.project Full controller implementation to back example. Aug 2, 2011
README Updated README to enummerate the current issues. Aug 2, 2011


Demo: Connecting DataGrid to a Store backed by Spring @MVC

This is a simple demo app to show connecting the new object store to a Spring @MVC RESTful controller.

The main source files of interest are: <- The Dojo grid client <- The Spring @MVC controller backing the JsonRest store

This is a WIP intended to test how easily we can support JsonStore with Spring MVC.  There are a couple of issues at the moment:
1. JsonStore doesn't set an Accept header when is issues PUT and POST requests, thus the wrong handler method (the one that produces HTML) is getting selected.
2. JsonStore sends its "sort" parameter in the form of "sort(+fieldName1,+fieldName2,-fieldName3,...)", thus the entire thing becomes the parameter key.  This is inconvenient to handle in Spring MVC as it requires dropping down to HttpServletRequest and iterating through parameter keys to find the one beginning with "sort", as opposed to being able to use the @RequestParam handler argument annotation.

The configured Maven setup should allow the full WAR to be built via 'mvn install', and optionally to be run in an embedded Tomcat instance via 'mvn tomcat:run'.

When running locally on Tomcat, the Dojo grid demo page is accessed at http://localhost:8080/dojo-json-rest-store/demo.html

Running the app locally requires a local MySql instance with a database named 'dojoTest'.  See /src/main/resources/ to edit connection settings for MySql.

This app can also be run on Cloud Foundry without any required changes.  Just run 'mvn install' and then 'vmc push {app_name} --path target/', and bind a MySql service to the app when given the choice.

The base application was generated with Spring Roo, thus it also includes the usual Roo HTML scaffolding.  The JsonRest store operations are supported in this case by explicitly adding more specific @RequestMappings to handle them. 
Something went wrong with that request. Please try again.