You can map request variables to a list of beans in struts2. Assuming you have the Parameters interceptor defined or are using the defaultStack.
1) Define a bean that contains
String question;
List<String> items;
2) Expose this bean as a list in your action class
List<MyBean> questions;
3) In your jsp send the request parameters like this.
<input type="text" name="questions[0].question" placeholder="Question 1"/>
<input type="text" name="questions[0].items[0]" placeholder="Item 1"/>
<input type="text" name="questions[0].items[1]" placeholder="Item 2"/>
<script>
var qcounter = 1;
var icounter = 2;
function addQuestion() {
// codes to add more input type=text like:
$('#myForm').append('<input type="text" name="questions[' + qcounter + '].question" placeholder="Question ' + (++qcounter) + '"/>');
icounter = 0;
}
function addItem() {
// codes to add more input type=text like:
$('#myForm').append('<input type="text" name="questions[' + (qcounter - 1) + '].items[' + icounter + ']" placeholder="Item ' + (++icounter) + '"/>');
}
</script>
You will have to consider what do when clicking the Add question button, in my example I am assuming that you want to reset the item count for the new question.
Here is a similar question about tabular form inputs in struts2. POST an array of custom objects to a Struts 2 action Hope this gives you an idea.