I have a number of textboxes that will be displayed with their existing values. I want my servlet to be able to get all their values and then update the database with the the values that have changed.
How do I get the values? Is there some way to put them into a HashMap with the id or name as the key and the value of the textbox as the value for the key?
If you’re giving all of the text boxes the same name, you can get a
String[]of the values viaServletRequest.getParameterValues.If you want to get all of your submitted fields in a single map, you can use
ServletRequest.getParameterMapto get aMapof all of the parameters submitted. Each individual parameter’s value in the map is aString[].Here’s some sample code that walks through all submitted parameters and all of their values: