ajax使用时的错误the server responded with a status of 404 (Not Found)

使用ajax跳转方法时,页面ctrl+shift+i调试报告了一个404错误,说找不到方法。页面地址栏直接指向方法的地址跳转也是404。目标方法是新增的,于是使用复制黏贴,确定各处方法名称一致之后,重启server。 
调试时再次报错:

jquery.min.js Failed to load resource: the server responded with a status of 404 (Not Found) 
send @ jquery.min.js:4 


这次的错误 在后台打印出了错误的原因:

 Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*)
        FROM  web114_keyword_rele r
        where r.del_flag ='0'

 ' at line 1

出错的xml语句为:

<select id="countReleSet" parameterType="java.util.HashMap" resultType="java.lang.Integer">
        SELECT COUNT (*)
        FROM  web114_keyword_rele r
        where r.del_flag ='0'
        <if test="keyId != null">
            and r.key_id = #{keyId,jdbcType=VARCHAR},
        </if>
        <if test="storeId != null">
            and r.store_id = #{storeId,jdbcType=VARCHAR}
        </if>
    </select>

一开始没反应过来错在哪里,就把语句扔到mysql里面跑了一遍,其实是count和(*)之间不应该有间隔,把语句改成

<select id="countReleSet" parameterType="java.util.HashMap" resultType="java.lang.Integer">
        SELECT COUNT(*)
        FROM  web114_keyword_rele r
        where r.del_flag ='0'
        <if test="keyId != null">
            and r.key_id = #{keyId,jdbcType=VARCHAR},
        </if>
        <if test="storeId != null">
            and r.store_id = #{storeId,jdbcType=VARCHAR}
        </if>
    </select>

即可。简直是一个愚蠢的错误。。。。。。 
写xml语句的时候,还是放到mysql里面跑一跑,确定没有语法问题再放进来。要不然后面报错了再调试还是挺讨厌的

本博客是博主转载自: https://blog.csdn.net/sinat_32034679/article/details/72763333

猜你喜欢

转载自blog.csdn.net/daimaxiaoxin/article/details/84171200
今日推荐