2017-12-05 4 views
0

게시 방법에 매개 변수를 보내는 데 문제가 있습니다. 어쩌면, 나는이 요청 beacause를, 잘못이 입력 매개 변수를 전송하고있어 400 오류 얻을json을 jsp로 요청을 보내려면 어떻게합니까?

방법의 내 strcuter :

@RequestMapping(value = "/create", method = RequestMethod.POST, headers = "Accept=application/json") 
    public @ResponseBody 
    String createProject(@RequestBody TestClass project) { 
    return "success"; 
    } 

대상 :

public class TestClass { 

    private String name; 
    private int age; 

    public String getName() { 
    return name; 
    } 

    public void setName(String name) { 
    this.name = name; 
    } 

    public int getAge() { 
    return age; 
    } 

    public void setAge(int age) { 
    this.age = age; 
    } 
} 

JSP :

<%@ page contentType="text/html;charset=UTF-8" language="java" %> 
<html> 
<head> 
    <title>Result</title> 
</head> 
<body> 
Successful create project 
</body> 
</html> 

그리고 저는 우편 배달부에서 보내지 만 400 오류 :스프링 문서 here 당으로 image of postman

답변

0

6,,

Expressions passed to the constructor with header names 'Accept' or 'Content-Type' are ignored.

당신은 동의하고 콘텐츠 형식에 대한 producesconsumes 속성을 사용해 볼 수 있습니까?

관련 문제