You can just use it as is. The parameter name will arrive literally in that form. JSP has no special treatment for this (unlike, for example, PHP). Therefore, you will need to disassemble yourself.
String[][] twodArray = new String[1][]; twodArray[0] = new String[2]; twodArray[0][0] = request.getParameter("twodArray[0][0]"); twodArray[0][1] = request.getParameter("twodArray[0][1]");
It might be easier to use standard HTTP conventions for multiple parameter names.
HTTP: // local: 8080 / queryWithQueryString twodArray [0] = StoreID & twodArray [0] = 101
with
String[][] twodArray = new String[1][]; twodArray[0] = request.getParameterValues("twodArray[0]");
It is probably easier to use List<String[]> instead of String[][] , since List can expand dynamically. This is useful if you do not know the number of items in advance.
List<String[]> twodArray = new ArrayList<String[]>(); for (int i = 0; i < Integer.MAX_VALUE; i++) { String[] values = request.getParameterValues("twodArray[" + i + "]"); if (values == null) break; twodArray.add(values); }
source share