栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Spring MVC 400错误请求Ajax

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Spring MVC 400错误请求Ajax

我解决了我的问题。为了使它起作用,我做了以下操作:首先,我将依赖关系更改为jackson2

<dependency>    <groupId>com.fasterxml.jackson.core</groupId>    <artifactId>jackson-annotations</artifactId>    <version>2.4.3</version></dependency><dependency>    <groupId>com.fasterxml.jackson.core</groupId>    <artifactId>jackson-core</artifactId>    <version>2.4.3</version></dependency><dependency>    <groupId>com.fasterxml.jackson.core</groupId>    <artifactId>jackson-databind</artifactId>    <version>2.4.3</version></dependency>

然后,我用@JsonProperty和@JsonIgnore注释了Book类。这是我更新的书本课

 @Entity    @Table(name="Book")    @Indexed    public class Book {    @Id    @GeneratedValue(strategy = GenerationType.AUTO)    @Column(name = "bookId")    @JsonIgnore    private Long id;    @Column(nullable = false)    @Field(index = Index.YES, analyze=Analyze.YES, store=Store.NO)    @JsonProperty("title")    private String title;    @Column(nullable = false, unique = true)    @JsonProperty("ISBN")    private String ISBN;    @Column(nullable = false)    @Field(index = Index.YES, analyze=Analyze.YES, store=Store.NO)    @JsonProperty("author")    private String author;    @JsonProperty("publisher")    private String publisher;    @Column(length = 1000)    @JsonProperty("description")    private String description;    @JsonProperty("publicationYear")    private int publicationYear;    @JsonProperty("pages")    private int pages;    @Enumerated(EnumType.STRING)    @Column(nullable = false)    @JsonIgnore    private BookStatus bookStatus;    @ManyToMany(mappedBy = "booksWant", cascade = CascadeType.ALL)    @JsonIgnore    private List<User> user = new ArrayList<User>(0);    @oneToMany(mappedBy = "book", cascade = CascadeType.ALL)    @JsonIgnore    private List<UserBook> bookList = new ArrayList<UserBook>(0);    public Book(String title, String ISBN, String author, String publisher, String description,     int publicationYear, int pages, BookStatus bookStatus) {        this.title = title;        this.ISBN = ISBN;        this.author = author;        this.publisher = publisher;        this.description = description;        this.publicationYear = publicationYear;        this.pages = pages;        this.bookStatus = bookStatus;    }     getters and setters}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/382568.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号