This is my web service method inside a Spring controller:
@RequestMapping(value = "/submit", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public @ResponseBody Response submitAppication(@RequestBody String submitString) {
    System.out.println("***************************  Entering for submit part ********************************");
    Response response = Response.status(400).build();
    try {
        JSONObject jsonObject = new JSONObject(submitString);
        jsonObject.put("event", "submit");
        SMEvent sme = new SMEvent(HttpMethod.POST, jsonObject);
        String tid = Util.getTid(jsonObject);
        response = handleEvent(sme, getVerificationType(tid), tid);
    } catch (JSONException e) {
        //TODO log some exception here
    } finally {
        return response;
    }
}
This is my HTML page with a form:
<div th:if="${InstaPanState==1 and InstaPanStateStatus==0}">
    <body>
    <form action="#" th:action="@{/submit}" method="post">
        <label><b>Name</b></label>
        <input type="text" placeholder="Your Name" name="name"/><br/><br/>
        <br/>
        <label><b>Father's Name</b></label>
        <input type="text" placeholder="Father's Name" name="fname"/><br/>
        <br/><br/>
        <label><b>Contact Number</b></label>
        <input type="number" placeholder="Contact Number"/><br/><br/><br/>
        <div class="clearfix">
            <button type="button" class="cancelbtn">Cancel</button>
            <button type="submit" class="submitbtn">Submit</button>
        </div>
    </form>
    </body>
</div>
When I click the submit button it should call the mentioned web service method.
Currently I got the following exception and it is not calling the web service.
Looking up handler method for path /submit 2017-09-25 15:41:36.189 DEBUG 5405 --- [nio-8080-exec-4] .m.m.a.ExceptionHandlerExceptionResolver : Resolving exception from handler [null]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded' not supported
 
     
     
    