title: How to send array to servlet with ajax
body: <p>Have to send an array to the servlet using ajax as follows</p>
  
  <pre><code>// My array "mapTest"
  var mapTest = {key1: ["a1", "a2", "a3"], key2: ["b1", "b2"]};
  $.ajax({
      type: "POST",
      url: "assembles-query",
      data: {
      "mapList[]" : mapTest
    },
      error:function(){
      console.log("ERROR");
    },
      success:function(responseText){
      $("textarea[id=assembleQuery]").text(responseText);
    }
  });
  </code></pre>
  
  <p>In the servlet try receives the values contained in the array as follows</p>
  
  <pre><code>String[] mapList = request.getParameterValues("mapList[]");
  </code></pre>
  
  <p>When I scroll through the values contained in the array is always returned <strong>java.lang.NullPointerException</strong></p>
  
  <pre><code>for (int i = 0; i &lt; mapaList.length; i++) {
       System.out.println(mapList[i]);
  }
  </code></pre>
  
  <p>What should I do to solve this problem? Since already thank you for everyone's help.</p>