On Spring with annotations, is there anyway that i can change the form action without changing the action using javascript?
For example on submit1 method invoked on the controller = method1
on submit2 method invoked on the controller = method2
@RequestMapping("/submit1")
public String submit1()
@RequestMapping("/submit2")
public String submit2()
…
<form:form id="dynamicfrm" method="post" action="archive/submit.do" commandName="submit">
<input type="submit1" value="">
<input type="submit2" value="">
Thank you!
If I understand you correctly – as others already said it isn’t absolutely clear – than you want to map one single form to different action methods dependending on the button that was clicked.
In your JSP you can change the code to something like this:
And in your controller you can narrow the mappings like this: