Documentation

Spring-Json View adds JavaScript Object Notation (Json) support to Spring-MVC. It provides an easy way to serve data to Ajax based front-ends using Spring-MVC the way you are used to using it. It provides almost all features you already know, for example, the Spring JstlView.

Basically, it is an implementation of an AbstractView. Now it adds

  • a Spring BindingResult,
  • Field and GlobalErrors,
  • executes Validations and PropertyEditors to convert property values to a display string

It also provides some useful features for working with Ajax frameworks, for example, prototype.js like the Error Handling. And of course it transforms the model to a Json String.

For a practical example please take a look at the Demo Application.

Binding

  1. Instruction
  2. JsonStringWriter
    1. SojoJsonStringWriter
    2. JsonlibJsonStringWriter
    3. XStreamJsonStringWriter
  3. Comparison

Validation

  1. Spring MVC validation example

Error handling

  1. Configuration
  2. HttpStatusError
  3. ModelFlagError
  4. Custom implementaton of a JsonErrorHandler

Filtering

  1. Instruction
  2. Recommended Filter Features
    1. JsonViewFilter
    2. Default JsonViewFilter - SimplePropertyFilter
    3. Custom implementaton of JsonViewFilter
  3. Other Filter Features
    1. StandartErrorConverter - The "model cleanup mode"
    2. Custom implementaton of JsonViewCallback
    3. Writer specific configuration via JsonWriterConfiguratorTemplates

Exception handling

  1. Configuration
  2. JsonErrorHandler
  3. JsonExceptionHandler
    1. ExceptionMessageExceptionHandler
    2. StackTraceExceptionHandler
    3. CustomImplementaton of JsonExceptionHandler

Other Configuration settings

  1. ContentType
  2. Encoding