title: Cannot call a function in java from JSP and JS
body: <p>I am trying to call a function from the controller with url <code>/OHRSFrontSheet</code> and the function looks like: </p>
  
  <pre><code>@RequestMapping(value = "/generateFrontSheet/{myId}", method = RequestMethod.POST)
  public void generateFrontSheet(@RequestParam("myId") Long Id) {
  SOP("Creating doc for ID = "+myId);
  //Create Document
  }
  </code></pre>
  
  <p>My java script is:</p>
  
  <pre><code>function createFrontSheet(id) {
   alert(id);
   $.post("/OHRSFrontSheet/generateFrontSheet",{Id:id});
  }
  </code></pre>
  
  <p>my jsp looks like:    </p>
  
  <pre><code>&lt;spring:url var="generateFrontSheetUrl"
      value="/OHRSFrontSheet/generateFrontSheet(${formId})"/&gt;                                         
  &lt;a href="javascript:createFrontSheet(${formId});"&gt;Download Doc&lt;/a&gt;
  </code></pre>
  
  <p>The problem withe the code is the <code>alert(id)</code> in the JS is called but it function <code>generateFrontSheet()</code> is not getting called. I get a 404 error.</p>
  
  <p>Am I missing something with respect to the parameter I am passing or the mappings?</p>