这是HTML
<input type="hidden" value="Brand" name="labelValue" />
<input type="hidden" value="model" name="labelValue" />
这是Servlet部分
String values=request.getParameter("labelValue");
如何将其转换为ArrayList
并且输入计数正在改变
答案 0 :(得分:2)
// 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));