Adding JSON support to domain objects and controllers
Let's say that you have developed the persistence layer of your application using Roo. Now, you want to expose the CRUD operations and dynamic finder methods defined in the Roo-generated JPA entities to the outside world via a RESTful interface.
Roo supports exposing CRUD operations and dynamic finders of JPA entities via RESTful interfaces that use JSON documents for exchanging data. As JSON is used by Roo-generated RESTful interfaces, you can modify JSPX pages of the Roo-generated Spring Web MVC application to use Ajax to interact with these RESTful interfaces.
Roo provides two commands for adding JSON support to existing classes in the Roo project:
json
add
: Adds JSON support to the class specified using theclass
argumentjson
all
: Adds JSON support to all the classes annotated with the@RooJavaBean
annotation
The json
add
and json
all
commands add the @RooJson
annotation to Java classes. the @RooJson
annotation results in the creation...