Java 如何通过ArrayList将相同名称的所有html输入值获取到servlet
这是HTMLJava 如何通过ArrayList将相同名称的所有html输入值获取到servlet,java,html,jsp,servlets,arraylist,Java,Html,Jsp,Servlets,Arraylist,这是HTML <input type="hidden" value="Brand" name="labelValue" /> <input type="hidden" value="model" name="labelValue" /> 如何将其发送到ArrayList且输入计数正在更改//返回一个字符串对象数组,其中包含给定请求参数的所有值,如果参数不存在,则返回null。 // Returns an array of String objects containin
<input type="hidden" value="Brand" name="labelValue" />
<input type="hidden" value="model" name="labelValue" />
如何将其发送到ArrayList
且输入计数正在更改//返回一个字符串对象数组,其中包含给定请求参数的所有值,如果参数不存在,则返回null。
// 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));
String[]values=req.getParameterValues(“labelValue”);
//将字符串数组转换为arrayList。您可以将其分配给变量并使用。
新的ArrayList(Arrays.asList(values));
//返回字符串对象数组,其中包含给定请求参数的所有值,如果参数不存在,则返回null。
String[]values=req.getParameterValues(“labelValue”);
//将字符串数组转换为arrayList。您可以将其分配给变量并使用。
新的ArrayList(Arrays.asList(values));
使用String[]请求。getParameterValues(String)
方法代替。请改用String[]请求.getParameterValues(String)
方法。
// 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));