If you're giving all of the text boxes the same name, you can get a String[]
of the values via ServletRequest.getParameterValues
.
If you want to get all of your submitted fields in a single map, you can use ServletRequest.getParameterMap
to get a Map
of all of the parameters submitted. Each individual parameter's value in the map is a String[]
.
Here's some sample code that walks through all submitted parameters and all of their values:
Iterator it;
Map params;
String name;
String[] values;
int n;
params = request.getParameterMap();
it = params.keySet().iterator();
while (it.hasNext())
{
name = (String)it.next();
values = (String[])params.get(name);
for (n = 0; n < values.length; ++n)
{
// ...use value[n]...
}
}