I’m trying to map a button action to the controller function.
When I tried with :
@RequestMapping(method = RequestMethod.POST)
public void processValidateGenerate
....
and
<input type="button" id="continue" name="continue"...>
that works just fine, but now i want to add another button, so to differentiate betweent them I added so for the first action :
@RequestMapping(method = RequestMethod.POST, params="continue")
public void processValidateGenerate
....
but the function is not called anymore when the button is pressed, I think that works only for a submit input.
Are there any solution to do this with a non submit input ?
Thank you
You can use javascript/jquery to do an ajax call and hit the required controller method.
now add the new button (It doesn’t matter even it isn’t a button, a div would suffice). Use the onclick function and give the javscript function name.
You can check the jquery ajax details here
I think this would help you.