This is the jquery function which returns 415 media type not found error
$('#save').on('click',function(){
alert("test");
var data = JSON.stringify(jQuery('#form').serializeArray());
console.log("data"+data);
$.ajax({
type: "POST",
url: "saveExpenses",
data: JSON.stringify(jQuery('#form').serializeArray()),
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: true,
success: function(data){alert("Success");}
})
})
and the controller:
@RequestMapping(value="/saveExpenses",method=RequestMethod.POST)
public String saveExpense(@RequestBody ExpensesSummary expenses, HttpServletRequest request,HttpSession session){
System.out.println("first name"+expenses.getFirstName());
String message = homeBankingDao.expenseSummary(expenses);
request.getSession().setAttribute("message",message);
return "login";
}
Perhaps you should have a look to produce and consume annotations and attributes. Those posts may certainly help:
Or I don't get it...
EDIT :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.