title: HTTP Status 406 – Not Acceptable in spring MVC
body: <p>I am working on simple Spring-MVC application(Not Maven) where I want to make a web service which returns a boolean but it gives a HTTP Status 406 – Not Acceptable error.
  Also I am trying to call a it from a JSP.</p>
  
  <p><strong>JSP :</strong> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;form action="${pageContext.request.contextPath}/getformatretension" method="post" id="form"&gt;
    &lt;p&gt;
     loc 1: &lt;input type="text" name="srcUrl" size="45" id="file" /&gt;
    &lt;/p&gt;
     &lt;p&gt;  
              loc 2 : &lt;input type="text" name="xlfUrl" size="45" id="xlffile"/&gt;  
         &lt;/p&gt;&lt;input type="Submit" value = "Submit"&gt;      
   &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Controller :</strong> </p>
  
  <pre><code>public class MyClassController {
  
      @RequestMapping(value = "/getformatretension", method = RequestMethod.POST)
  
      public ResponseEntity&lt;Boolean&gt; methodName(@RequestParam("srcUrl") String srcUrl
              ,@RequestParam("xlfUrl") String xlfUrl) throws IOException{
  
          int nReturnVal = JsoupParserHtml.test(xlfUrl, srcUrl); 
          String mimeType=  "text/plain;charset=UTF-8";
          HttpHeaders headers = new HttpHeaders();
          headers.add("Content-Type", mimeType);
             if(nReturnVal ==  1) 
             { 
                  System.out.println("Success");
                  return new ResponseEntity&lt;Boolean&gt;(true,HttpStatus.OK);
  
             }
             else {
                 System.out.println("error");
                 return new ResponseEntity&lt;Boolean&gt;(false,HttpStatus.BAD_REQUEST);
             }
  
          }
  </code></pre>
  
  <p>Error : </p>
  
  <blockquote>
    <p>HTTP Status 406 – Not Acceptable</p>
    
    <p>Type Status Report</p>
    
    <p>Description The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation.</p>
  </blockquote>