I have a form with a few predefined textboxes and now apart from that I have also created some dynamic textboxes and I can do it with javascript (I guess). How to set the value of a dynamically generated textbox to a bean when a form is submitted. In the bean, I defined a string array to hold the contents of the dynamically generated textbox value. I am not using any framework, please guide me how to do this?
You can give all input fields the same name and then use request.getParameterValues() to get all values in the order they appear in the HTML DOM tree.
For example (JavaScript generation)
and
You can also add incrementing numbers after the name, such as
For example andfoo1
,foo2
,foo3
, etc. and collect the values in a loop until ## is received #null.