Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var user = {
- "username" : "test",
- "password" : "test",
- "ID" : 1
- };
- $.ajax({
- url: "/test1",
- type: "POST",
- data: JSON.stringify(user),
- contentType:"application/json; charset=utf-8",
- success: function() {
- alert("success")
- }
- })
- @RequestMapping(value = "/test1")
- public String test2(@RequestBody User user) {
- //Can't receive the Param.
- // console result : null
- System.out.println(user.getAge());
- //Nothing wrong
- //console result:
- // username: test
- // password: test
- System.out.println(user.getUsername());
- System.out.println(user.getPassword());
- return "test";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement