title: How to get data from POST-form with spark java?
body: <p>I'm pretty new with all these things but hope that you guys can help me understand how does it work. I got a form with field . How do i get data from client back? Was looking for some information but couldnt find.</p>
  
  <pre><code>&lt;form action="/login" method="POST"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;MemberId&lt;/legend&gt;
          &lt;div class="form-group"&gt;
              &lt;div class="row colbox"&gt;
                  &lt;div class="col-lg-4 col-sm-4"&gt;
                      &lt;label for="txt_memberid" class="control-label"&gt;MemberId&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="col-lg-8 col-sm-8"&gt;
                      &lt;input class="form-control" id="txt_memberid" name="txt_memberid" placeholder="MemberId" type="text" value="" /&gt;
                      &lt;span class="text-danger"&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;legend&gt;Login&lt;/legend&gt;
          &lt;div class="form-group"&gt;
              &lt;div class="row colbox"&gt;
                  &lt;div class="col-lg-4 col-sm-4"&gt;
                      &lt;label for="txt_username" class="control-label"&gt;Username&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="col-lg-8 col-sm-8"&gt;
                      &lt;input class="form-control" id="txt_username" name="txt_username" placeholder="Username" type="text" value="" /&gt;
                      &lt;span class="text-danger"&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;div class="row colbox"&gt;
                  &lt;div class="col-lg-4 col-sm-4"&gt;
                      &lt;label for="txt_password" class="control-label"&gt;Password&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="col-lg-8 col-sm-8"&gt;
                      &lt;input class="form-control" id="txt_password" name="txt_password" placeholder="Password" type="password" value="" /&gt;
                      &lt;span class="text-danger"&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;div class="col-lg-12 col-sm-12 text-center"&gt;
                  &lt;input id="btn_login" name="btn_login" type="submit" class="btn btn-default" value="Login" /&gt;
                  &lt;input id="btn_cancel" name="btn_cancel" type="reset" class="btn btn-default" value="Cancel" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/fieldset&gt;
  </code></pre>
  
  <h1>    </h1>
  
  <pre><code>    get("/login", (request, response) -&gt; {
          ConsoleLog.consoleLog(log, request);
          HashMap model = new HashMap();
          model.put("content", new VelocityTemplateEngine().render(new ModelAndView(new HashMap(),"templates/form_login.vtl")));
          return new ModelAndView(model, "templates/base.vtl");
      }, new VelocityTemplateEngine());
  
      post("/login", (request, response) -&gt; {
          ConsoleLog.consoleLog(log, request);
          Integer memberId = -1;
          String username = "";
          String password = "";
          try {
              username = request.queryParams("txt_username");
              password = request.queryParams("txt_password");
              memberId = new Integer(request.queryParams("txt_memberid"));
          } catch (Exception e) {}
          log.info("MemberId="+memberId+" UserName="+username+" Password="+password);
          if (new MemberDAO().isAuth(new Auth(username,password,memberId))) {
              request.session(true);
              request.session().attribute("txt_memberid", memberId);
              request.session().attribute("txt_username", username);
          }
          return "process";
      });
  </code></pre>
  
  <p>If I send form (method=get) - all works fine request.queryParams(XXXX)
  If I send form (method=post) - in request.queryParams - nothing</p>
  
  <p>Maybe anyone know what I should do in POST request?</p>