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
(for XML) to represent the same product information as the XML/JSON format.
Spring MVC Beginner's Guide
By :
Spring MVC Beginner's Guide
By:
Overview of this book
Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Configuring a Spring Development Environment
Spring MVC Architecture – Architecting Your Web Store
Control Your Store with Controllers
Working with Spring Tag Libraries
Working with View Resolver
Intercept Your Store with Interceptor
Validate Your Products with a Validator
Give REST to Your Application with Ajax
Apache Tiles and Spring Web Flow in Action
Testing Your Application
Using the Gradle Build Tool
Pop Quiz Answers
Index
Customer Reviews