ajax请求报406问题

首先查看是否有架包:

jackson-core-asl-1.9.10.jar;

jackson-mapper-asl-1.9.9.jar;

其次修改spring 配置文件为:

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> 
    <property name="messageConverters"> 
        <list> 
            <!-- 设置返回字符串编码 --> 
            <bean class="org.springframework.http.converter.StringHttpMessageConverter"> 
                <property name="supportedMediaTypes"> 
                    <list> 
                        <value>text/html;charset=UTF-8</value> 
                    </list> 
                </property> 
            </bean> 
            <!-- json转换器 --> 
            <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> 
                <property name="supportedMediaTypes"> 
                    <list> 
                        <value>text/html;charset=UTF-8</value> 
                        <value>application/json;charset=UTF-8</value> 
                        <value>application/x-www-form-urlencoded;charset=UTF-8</value> 
                    </list> 
                </property> 
            </bean> 
        </list> 
    </property> 
</bean> 

原文地址:https://www.cnblogs.com/wuyandijun/p/8607840.html