Spring 4.0 MVC 요청 JSON DATAGRAM 406 오류, 해결 방법은 무엇입니까?
Solution 1:
1. Jackson-Core-2.5.1.jar 및 Jackson-Databind-2.5.1.jar
2. 스프링 구성 파일 추가 :
<!-IE가 ajax를 실행할 때 JSON의 반환을 피하고, 파일 다운로드 Spring3은 : org.springframework.http.converter.json.mappingjacksonhttpmessageconverterspring4 IS : org.springframework.http.converter.json.mappingjackson2httpmessageconverter-> id = "Mapping JacksonhttpMessageConverter"> <property name = "supportedMediAtypes"> <list> <toft/html; charset = utf-8 </value> </list> </property> </bean> <!-Spring MVC의 주석 함수, 요청 및 주석의 매핑을 완료합니다. <list> <Ref Bean = "Mapping JacksonhttpMessageConverter"/> <!-JSON 변환기-> </list> </property> </bean>
Solution 2:
1. FastJson 패키지 (Alibaba), FastJson-1.2.7.jar의 Fastjson 패키지를 가져옵니다
2. 스프링 구성 파일 추가 :
<MVC : Annotation-Driven> <MVC : Message-Converters Register-defaults = "true"> <!-ajax를 실행할 때 파일 다운로드를 피하십시오-> <bean id = "fastjsonhttpmessageconverter"> <property name = "supportedMediatyTypes"> <list> <values> application/json; </mvc : 메시지-콘버터> </mvc : 주석 구동>
위는이 기사의 모든 내용입니다. 모든 사람의 학습에 도움이되기를 바랍니다. 모든 사람이 wulin.com을 더 지원하기를 바랍니다.