The request sent by the client was syntactically incorrect

This seems to be a common error during form submission in Spring WebMVC. Hence finding the root cause behind this may be difficult.

I verified step by step and confirmed that my call reaches my controller. But it breaks with the following error.

400 The request sent by the client was syntactically incorrect

Rightly pointed out at this is my date issue. I had a date field in my form. You can check my previous post on how to add jQuery date picker.

Hence, I need to make some modifications.

I added the following initBinder() method in the controller.

@RequestMapping(value="/add_expense", method=RequestMethod.POST)
    public String addExpense(@ModelAttribute ExpenseDetail expenseDetail, Model model) {
        try {
            System.out.println("===> returning add_expense"+expenseDetail.getExpenseCurrency());
            model.addAttribute("expenseList", new ExpenseDAO().getExpenseRecords());
            model.addAttribute("expenseDetail", new ExpenseDetail());
        } catch (ClassNotFoundException e) {
        } catch (SQLException e) {
        return "home";
    public void initBinder(WebDataBinder binder){
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s