O'Reilly logo

Spring MVC Beginner’s Guide by Amuthan G

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using ContentNegotiatingViewResolver

Content negotiation is a mechanism that makes it possible to serve a different representation of the same resource. For example, so far we have displayed our product detail page in a JSP representation. What if we want to represent the same content in an XML format, and similarly, what if we want the same content in a JSON format? There comes Spring MVC's ContentNegotiatingViewResolver (org.springframework.web.servlet.view.ContentNegotiatingViewResolver) to help us. The XML and JSON formats are popular data interchange formats that are used in web service communications heavily. So, using ContentNegotiatingViewResolver, we can incorporate many views such as MappingJacksonJsonView (for JSON) and MarshallingView ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required