Spring MVC Post Request

Viewed 43495

I have something like

@RequestMapping("/property")
@ResponseBody
public String property(@RequestBody UserDto userDto ) {

    System.out.println(userDto.getUsername());
    System.out.println(userDto.getPassword());

    return "Hello";
}

in my controller.

But it gives me an error when I post with

<form method="post" action="http://localhost:8080/home/property">

    <input name="username"/>
    <input name="password"/>
    <input type="submit"/>
</form>

in my html. Where am I going wrong.

5 Answers
Related