Validating a POST request is very easy. Just register a validator in the usual Spring way. Spring-Json View adds any errors as a field name : error message pair to a fielderrors array in the response Json object.


Write your validator class by implementing the Validator interface.

 public class SpringJsonValidator implements Validator {
    public void validate(Object obj, Errors errors) {
        SpringJsonForm form = (SpringJsonForm) obj;
        if (form.getPlaceofbirth() == null || "".equals(form.getPlaceofbirth())) {
            errors.rejectValue("placeofbirth", "", null, "Placeofbirth required.");
    public boolean supports(Class clazz) {
        return SpringJsonForm.class.equals(clazz);

Spring application-context

Configure the SimpleFormController by adding the validator.

    <bean name="simpleJsonPostFormController" 
        <property name="commandClass">
        <property name="formView"><value>jsonView</value></property>
        <property name="successView"><value>jsonView</value></property>
        <property name="validator"><ref bean="validator"/></property>
    <bean name="validator" class="org.thing.spring.json.controller.SpringJsonValidator"/>


Spring-Json View adds fielderrors to the Json response.

            "placeofbirth":"Please enter a a place of birth!"