Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

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
Index

Resolving views


As we already mentioned, Spring MVC does not make any assumption about any specific view technology. According to Spring MVC, a view is identifiable as an implementation of the org.springframework.web.servlet.View interface, shown as follows:

public interface View {

  String getContentType();

  void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception;

}

The render method from the Spring MVC View interface defines the main responsibility of a view object. The responsibility is that it should render of proper content as a response (javax.servlet.http.HttpServletResponse) based on Model and request (javax.servlet.http.HttpServletRequest).

Because of the simplicity of Spring MVC's View interface, we can write our own view implementation if we want. However, Spring MVC provides many convenient view implementations that are ready for use by simply configuring it in our web application's context configuration file.

One such...