Spring MVC – Multiple Submit Buttons Example

Spring MVC – Multiple Submit Buttons Example

Let us see an example code today for Spring MVC that has multiple submit buttons in one form. This is Second spring mvc tutotial. (Spring MVC example1 is here).

In this example, We are going to have 2 submit buttons. “Success” and “Failure”. When user clicks “Success” button it should pass to Controller and do some functions and take the user to respective page. Similarly when user clicks “Failure” it should go to Controller and then pass it to respective page.

Structure:
Structure

com.javainfinite.pojo
employee.java

page1.jsp

page2.jsp (Success click page)

page3.jsp (Failure click page)

com.javainfinite.controller
econtroller.java

applicationContext.xml

dispatcher-servlet.xml

Output:
output1

On Clicking Success Button,

output2

On clicking Failure Button,

output3

 

 

 

 

 

 

 

2 thoughts on “Spring MVC – Multiple Submit Buttons Example

Leave a Reply

Your email address will not be published. Required fields are marked *