title: How can i redirect to some url if user directly enters the link. Also, if button already exists to a specific url (in spring boot)
body: <p>I have a post method which simply update something to my database but there is loophole
  I have settled this method to button with onclick using javascript and when button clicked it blocks button for other 10 seconds
  but when I tried with direct URL it doesn't disables button for 30 seconds why ?</p>
  <p>here is my post mapping code</p>
  <pre><code>@RequestMapping(value = &quot;/Balnce_add&quot;, method ={RequestMethod.POST, RequestMethod.GET})
  public ModelAndView GoesUp(@AuthenticationPrincipal CustomUserDetails currentuser) throws IOException {
      if (isAuthenticated()) {
      int x=currentuser.getBalance() +10;
      currentuser.setBalance(x);
      repo.setUserInfoById(x,currentuser.getId());
      repoofdata.setDataInfoById(x,currentuser.getId());
      System.out.println(currentuser.getName()+&quot; (new balance) ==&gt; &quot; +currentuser.getBalance());
      return new ModelAndView(&quot;redirect:&quot;+&quot;/game1&quot;);    // here game1 is HTML page with getmapping
       }
      return new ModelAndView(&quot;redirect:&quot;+&quot;/signin&quot;);   // here signing is HTML page with getmapping
  }
  </code></pre>
  <p>and here is my HTML code with on click javascript function</p>
  <pre><code>    &lt;button  id=&quot;upside&quot; onclick=&quot;up(true)&quot; type=&quot;submit&quot; class=&quot;btn btn-success&quot;&gt;Up&lt;/button&gt;
  </code></pre>