In my JSP file I have form with flexible number of inputs - user has a possibility to add or delete inputs of a form(I did it using Javascript). Therefore form hasn't got a fixed number of inputs. This is required. Now I want to create controller taking these parameters but... I can't specify how many of inputs there will be. They're all Strings. Is there any way to pass these inputs into a controller? I'm using Spring and JSP for the views.
Asked
Active
Viewed 37 times
0
-
What about this? http://stackoverflow.com/questions/8504258/spring-3-mvc-accessing-httprequest-from-controller – Betlista Jan 25 '16 at 15:09
1 Answers
1
It is no simplest variant, but anyway:
$('#yourInputForm').submit(function (event) {
event.preventDefault();
var arr = []
$('#yourInputForm').find('input').each(function () {
arr.push($(this).val());
});
});
Pay attention, I didn't check if val() is empty. Inside this function you can send you arr with ajax to your controller.

Optio
- 7,244
- 2
- 22
- 30