Javatpoint Logo

91-9990449935

 0120-4256464

Spring MVC Form Example

Here, we will learn how to handle a form data in spring MVC without using database. Here, we will use @Controler, @RequestMapping and @ModelAttribute annotations.

To display the input form, we are going to use <form:form> tag of spring framework. Let's see a simple example to store form data in a model object and display data of a list.


Required Jar files

To run this example, you need to load:

  • Spring Core jar files
  • Spring Web jar files

download all the jar files for spring including core, web, aop, mvc, j2ee, remoting, oxm, jdbc, orm etc.


index.jsp

Emp.java

EmpController.java

web.xml

spring-servlet.xml

empform.jsp

viewemp.jsp

Output

spring mvc form output1 spring mvc form output2 spring mvc form output3 spring mvc form output4

Download spring MVC example

We have created this application in MyEclipse IDE which already provides the jar files. If you use eclipse or other IDE's, you need to load the jar file for spring MVC.