1. 前段代码
<input type="text" name="option">
<input type="text" name="option">
2. Servlet接收
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String[] options = request.getParameterValues("option");
for (String s : options) {
System.out.println(s);
}
}
3. SpringMVC接收
@GetMapping("/addOption")
public String addOption(String... option) {
for (String s : option) {
System.out.println(s);
}
return "/";
}