0

This is the HTML

<input type="hidden" value="Brand" name="labelValue" />
<input type="hidden" value="model" name="labelValue" />

This is the Servlet part

String values=request.getParameter("labelValue");

how to get this to a ArrayList and the input count is changing

Dalorzo
  • 19,834
  • 7
  • 55
  • 102
Suhad Mendis
  • 51
  • 1
  • 11
  • use the `String[] request.getParameterValues(String)` method instead. http://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#getParameterValues-java.lang.String- – CollinD Sep 13 '17 at 17:16

1 Answers1

3
// Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
String[] values=req.getParameterValues("labelValue");

// Convert String array to arrayList. You can assign this to variable and use.
new ArrayList<String>(Arrays.asList(values));
voloshin
  • 536
  • 7
  • 17