I have a form with few predefined textboxes, now in addition to that I have create some dynamic textboxes which I can do it in javascript(I guess). How do I set the value of dynamically generated textboxes to a bean when the form is submitted. In the bean I have string array defined to hold the content of dynamically generated textbox values. I am not using any framework, guide me how to do this ?
Share
You can just give all input fields the same name and use
request.getParameterValues()to get all values in order as they appeared in the HTML DOM tree.E.g. (JavaScript-generated)
with
You can also suffix the name with an incremental digit such as
foo1,foo2,foo3, etc and collect the values in a loop with until anullis received.E.g.
with