SSM遇到的问题(四)

1. ajax请求错误:$.get is not a function

JQuery: $.get is not a function

解决:

<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
复制代码

改成

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
复制代码

额外扩展:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
复制代码

现在的boostrap的引用中多了integritycrossorigin两个属性,了解一下,作用是什么?

What are the integrity and crossorigin attributes?

大概就是,引入两个属性,保证资源的完整性。也可以不引用。

2.SSM的页面有ajax请求返回数据,返回失败。

提示:返回的类型对象无法转换成json输出。


  1. Failed to write HTTPmessage:org.springframework.http.converter.HttpMessageNotWritableException: No

  2. java.lang.IllegalArgumentException: No converter found for return value of type

    由此了解到要想输出转换成为json对象,要保证类型的字段属性,都有开放(public)的getter/setter


  1. Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Co

    由此了解到,如果转换的类型中有些字段不需要生成时,可以使用 @JsonIgnoreProperties() 来忽略生成json对象的属性。


  1. SpringMVC返回对象类型报错HttpMessageNotWritableException: No converter found for return value of type

    json配置

    <!--fastjson的配置-->
        <mvc:annotation-driven>
            <mvc:message-converters>
                <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
                    <property name="supportedMediaTypes" value="application/json;charset=utf-8"/>
                </bean>
            </mvc:message-converters>
        </mvc:annotation-driven>
    复制代码

    解决:很尴尬,因为没有进行配置,所以出现,无法转换json对象的错误。

转载于:https://juejin.im/post/5ce0144be51d4510674d41ea

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值