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

Serving and processing forms


Spring supports different view technologies, but if we are using JSP-based views, we can make use of the Spring tag library tags to make up our JSP pages. These tags provide many useful, common functionalities such as form binding, evaluating errors outputting internationalized messages, and so on. In order to use these tags, we must add references to this tag library in our JSP pages as follows:

<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>

In all of our previous chapters' examples, we saw that the data transfer took place from model to view via the controller. The following line is a typical example of how we put data into the model from a controller:

model.addAttribute(greeting,"Welcome")

Similarly the next line shows how we retrieve that data in the view using the JSTL expression:

<p> ${greeting} </p>

Note

JavaServer Pages Standard Tag Library...