zoukankan      html  css  js  c++  java
  • ajax406错误

    如上,ajax请求时一直返回error,但是后台已经正确返回。网上给出的解决办法是spring3.*的,但我的是sppring 4.*的,应该不适用,我也没试。

    思索一下,406 not acceptable,直译过来是不接受,不接受什么呢?后台既然已经返回,前台不接受

    是不是和数据格式有关?

    但前台要求的是json

     后台返回的也是json。是不是和json格式有关?之前后台用的json是org.json,是不是不接受org.json,试了一下改成了net.sf.json,这次终于通了!应该是ajax对json格式有要求,而net.sf.JSONObject和org.json.JSONObject格式不一样

    20190428:

    发现完整引入如下

            <!-- json-lib -->
            <dependency>
                <groupId>net.sf.json-lib</groupId>
                <artifactId>json-lib</artifactId>
                <version>${json-lib.version}</version>
                <classifier>jdk15</classifier>
            </dependency>
            <!-- Jackson Json处理工具包 -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.4.2</version>
            </dependency>
  • 相关阅读:
    浅谈聚类算法(K-means)
    多步法求解微分方程数值解
    本学期微分方程数值解课程总结(matlab代码)
    Stone Game
    Two Sum IV
    Insert into a Binary Search Tree
    Subtree of Another Tree
    Leaf-Similar Trees
    Diameter of Binary Tree
    Counting Bits
  • 原文地址:https://www.cnblogs.com/yanan7890/p/8916634.html
Copyright © 2011-2022 走看看