Book Image

Spring MVC: Beginner's Guide - Second Edition

By : Amuthan Ganeshan
Book Image

Spring MVC: Beginner's Guide - Second Edition

By: Amuthan Ganeshan

Overview of this book

Spring MVC helps you build flexible and loosely coupled web applications. The Spring MVC Framework is architected and designed in such a way that every piece of logic and functionality is highly configurable. Also, Spring can integrate effortlessly with other popular web frameworks such as Struts, WebWork, Java Server Faces, and Tapestry. The book progressively teaches you to configure the Spring development environment, architecture, controllers, libraries, and more before moving on to developing a full web application. It begins with an introduction to the Spring development environment and architecture so you're familiar with the know-hows. From here, we move on to controllers, views, validations, Spring Tag libraries, and more. Finally, we integrate it all together to develop a web application. You'll also get to grips with testing applications for reliability.
Table of Contents (20 chapters)
Spring MVC Beginner's Guide - Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Resolving Views


As I already mentioned, Spring MVC does not make any assumptions about specific View technologies. According to Spring MVC, a View is identifiable as an implementation of the org.springframework.web.servlet.View interface:

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, as the main responsibility for a view object, that it should render proper content as a response (javax.servlet.http.HttpServletResponse) based on the given Model and request (javax.servlet.http.HttpServletRequest).

Because of the simplicity of the Spring MVC View interface, if we want we can write our own View implementation. But Spring MVC provides many convenient View implementations that are ready to use by simply configuring them in our web application context configuration file...