In this tutorial we are going to develop Spring 3 MVC form example. This application will help you learn the concept of Spring 3 MVC forms.

Spring 3 MVC Form Example

In this tutorial we are going to develop Spring 3 MVC form example. This
application will help you learn the concept of Spring 3 MVC forms. After
completing this tutorial you will be able to understand the Spring 3 MVC based
applications and use the knowledge gained here in developing more complex
applications using Spring 3 MVC module.

In this
application there are two jsp files. One jsp file for allowing the user to enter User Name
and Email and another jsp file to display the same values into another JSP
page. We have also developed a controller to process the request and then return
the Model and view for rendering the output. The SimpleFormController.java class
is developed by us to work as controller here. This is the annoted controller
used in the application.

You can download and open the project
in Eclipse IDE and then run it in eclipse. You will be needing the tomcat server
to run the application from Eclipse.

The annotation @Controller makes this class a controller. The @RequestMapping
annotation is used to map a business method to the request uri. In the following
code snippet /simpleForm.html uri is mapped to the simpleForm(..)
method. The method = RequestMethod.GET is for mapping the GET method. Here is
full code of simpleForm(..) function mapping: