spring mvc

Ignoring Unrecognized JSON Fields With Spring & Jackson

March 13, 2015 by

If you try to bind JSON to an object in Spring MVC with Jackson, then you might have seen the below error before. Could not read JSON: Unrecognized field \”something\” (class com.codingexplained.user.dto.account), not marked as ignorable […] This error occurs whenever an unknown field is encountered in the JSON; that is, a field specified in the JSON is not… read more

Date Parameter in Spring MVC Controller

March 1, 2015 by

Need to pass a date as a java.util.Date instance in a Spring MVC controller action? Then you have come to the right place. You might have tried the below approach and encountered a good old 404 Not Found error. @Controller public class CompanyController { @RequestMapping("/company/added-since/{since}") public String showAddedSince(@PathVariable("since") Date since) { return "companies-added-since"; } }… read more

Neither BindingResult nor plain target object available as request attribute

February 21, 2015 by

If you are trying to bind a Spring MVC form to a bean, then you might have come across the below exception. Neither BindingResult nor plain target object for bean name ‘mybean’ available as request attribute Some tutorials claim that you can do like this: @Controller public class PersonController { @RequestMapping(value = "/person/add", method =… read more