Request Mapping for 2 forms within the same JSP page

I have 2 forms within the same jsp page, I want to link one form to a method in the controller while the other form to another method in the controller. Would like to know how do I write the RequestMapping since both the form’s method is POST and invoke the same from the jsp file.

Change the form action to different or expected urls

Form#1
<form action="url1" method="post">
<submit/>
</form>
Form#2
<form action="url2" method="post">
<submit/>

Controller:

@RequestMapping("url1")
public method1(){
}

@RequestMapping("url2")
public method2(){
}

Did you try something like this!

yes I tried it but it isnt working

@sharonvarghese Why not take a look at this link:

1 Like

@osagie_ehigiato Thanks for the links :smile: