2017-12-24 11 views
0

모델 북.스프링 부트의 SpringInputGeneralFieldAttrProcessor

서비스, 어떻게해야합니까 서비스를

public Model saveModal(Model model, Book book){ 
model.addAttribute("categories",categoryDaoInterface.getAllActive()); 
model.addAttribute("book", new Book()); 
bookDaoInterface.saveBook(book); 
return model;} 

컨트롤러 용 다운로드 halaman 책

@RequestMapping(value="/book/",method = RequestMethod.POST) 
public String saveBook(@ModelAttribute("book") Book book, Model model){ 
bookService.saveModal(model, book); 
return "redirect:/book";} 

를 사용하여 컨트롤러 모델을 연결?

Screenshot error

답변

0

클래스 모델 도서, (질문의 일부)

public class Book { 
    public Book() {} 
    private Integer book_id, category_id; 
    private String isbn, book_title; 
    private String author, publisher, location; 
    private Double price_after, price_before; 
    private Integer discount, stok, status; 

     public Book(Integer book_id, Integer category_id, String isbn, String book_title, String author, String publisher, String location,Integer discount, Double price_before, Double price_after, Integer stok, Integer status) { 
     this.book_id = book_id; 
     this.category_id = category_id; 
     this.isbn = isbn; 
     this.book_title = book_title; 
     this.status = status; 
     this.author = author; 
     this.publisher = publisher; 
     this.location = location; 
     this.price_after = price_after; 
     this.price_before = price_before; 
     this.discount = discount; 
     this.setStok(stok); 
    } 

    public Integer getStatus() { 
     return status; 
    } 

    public void setStatus(Integer status) { 
     this.status = status; 
    } 

    public Integer getCategory_id() { 
     return category_id; 
    } 

    public void setCategory_id(Integer category_id) { 
     this.category_id = category_id; 
    } 

    public Integer getBook_id() { 
     return book_id; 
    } 

    public void setBook_id(Integer book_id) { 
     this.book_id = book_id; 
    } 

    public String getIsbn() { 
     return isbn; 
    } 

    public void setIsbn(String isbn) { 
     this.isbn = isbn; 
    } 

    public String getBook_title() { 
     return book_title; 
    } 

    public void setBook_title(String book_title) { 
     this.book_title = book_title; 
    } 

    public String getAuthor() { 
     return author; 
    } 

    public void setAuthor(String author) { 
     this.author = author; 
    } 

    public String getPublisher() { 
     return publisher; 
    } 

    public void setPublisher(String publisher) { 
     this.publisher = publisher; 
    } 

    public String getLocation() { 
     return location; 
    } 

    public void setLocation(String location) { 
     this.location = location; 
    } 

    public double getPrice_after() { 
     return price_after; 
    } 

    public void setPrice_after(double price_after) { 
     this.price_after = price_after; 
    } 

    public double getPrice_before() { 
     return price_before; 
    } 

    public void setPrice_before(double price_before) { 
     this.price_before = price_before; 
    } 

    public Integer getDiscount() { 
     return discount; 
    } 

    public void setDiscount(Integer discount) { 
     this.discount = discount; 
    } 

    public Integer getStok() { 
     return stok; 
    } 

    public void setStok(Integer stok) { 
     this.stok = stok; 
    } 
} 
관련 문제