title: How do I use Java Spark Framework queryMaps?
body: <p>My Html is of the form </p>
  
  <pre><code>     &lt;input type="hidden" name="SONGS" value="6242,6243,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,"&gt;
  
   &lt;tr&gt;
      &lt;td&gt;
          01 - Big Love.WAV
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6242TRACK" value="01"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6242ARTIST" value="Fleetwood Mac"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6242ARTIST_SORT" value="Fleetwood Mac"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6242TITLE" value="Big Love"&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          02 - Seven Wonders.WAV
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6243TRACK" value="02"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6243ARTIST" value="Fleetwood Mac"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6243ARTIST_SORT" value="Fleetwood Mac"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="text" name="6243TITLE" value="Seven Wonders"&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>When user submits the form data it is processed using Spark framework. My logic was get the list of recnos from the SONGS input field, and then for each recNo browse the input fields starting with that recno. But its not working, <strong>I think I am misunderstanding how queryMaps work</strong> </p>
  
  <pre><code>protected void saveData(Request req)
      {
         String[] recNos = req.queryParams(EditSongsPage.SONGS).split(",");
         for(String recNo:recNos)
         {
             System.out.println("recNo--------------"+recNo);
             for(String next:req.queryMap(recNo).values())
             {
  
                 System.out.println(next);
             }
         }
  
      }
  </code></pre>
  
  <p>but this gives</p>
  
  <pre><code>recNo--------------6242
  02/03/2018 08.58.22:GMT:com.jthink.songkong.server.callback.ServerEditSongs:startTask:SEVERE: null
  java.lang.NullPointerException
      at spark.QueryParamsMap.values(QueryParamsMap.java:262)
      at com.jthink.songkong.server.callback.ServerEditSongs.saveData(ServerEditSongs.java:80)
      at com.jthink.songkong.server.callback.ServerEditSongs.startTask(ServerEditSongs.java:52)
      at com.jthink.songkong.server.CmdRemote.lambda$null$62(CmdRemote.java:171)
      at spark.RouteImpl$1.handle(RouteImpl.java:72)
      at spark.http.matching.Routes.execute(Routes.java:61)
      at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
      at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at org.eclipse.jetty.server.Server.handle(Server.java:564)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
      at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
      at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>