title: Passing localstorage value to Server (Java, JSP)
body: <p>im currently creating a canvas Javascript game and im passing localstorage variable to my database which is the Score. Score being 'elapsed'. When i was debugging i saw that the localstorage value is there. But it just doesnt seem to store into the database. Preferably without the use of Ajax?</p>
  
  <pre><code>function drawElapsedTime(){
          var elapsed=parseInt((new Date() - startTime)/1000);
          g.save();
          g.beginPath();
          g.fillStyle="#008000";
          g.font="14px Verdana"
          // draw the running time at half opacity
          g.globalAlpha=0.50;
          g.fillText(elapsed+" secs",canvas.width-75,25);
          localStorage.setItem("score",elapsed);
          g.restore();
  
      }
   var storedTime = localStorage.getItem("score");
  
   &lt;form action="UserActionServlet" method="post"&gt;
  
  
                   &lt;input type="submit" value="scoreObj" class="submit" /&gt;
  
       &lt;/form&gt;
  </code></pre>
  
  <p>Command:</p>
  
  <pre><code>String xscore = request.getParameter("score");
  
          int score = 0;
          if (xscore != null) {
              score = Integer.parseInt(xscore);
          }
   System.out.println(xscore);
  </code></pre>