[code=Java]
package com. Wh. Controller;
The import org. Springframework. Beans. Factory. The annotation. Autowired;
The import org. Springframework. Stereotype. The Controller;
The import org. Springframework. UI. Model;
The import org. Springframework. Web. Bind. The annotation. RequestMapping;
The import com. Wh. Po. The Book;
The import com. Wh. Service. BookService;
@ Controller
Public class BookController {
The @autowired
Private BookService BookService;
//by many conditions find books
@ RequestMapping ("/findBookByCondition ")
Public String findBookByCondition (Model Model, Book Book) {
Model. The addAttribute (" books, "bookService. FindBookByCondition (book));
Return ". The main JSP ";
}
//add books
@ RequestMapping ("/doAdd ")
Public String doAdd (Book Book) {
BookService. DoAdd (book);
The return of "redirect: findBookByCondition";
}
//by isbn delete books
@ RequestMapping ("/doDel ")
Public String doDel (Book Book) {
BookService. DoDel (book);
The return of "redirect: findBookByCondition";
}
@ RequestMapping ("/doUpdate ")
Public String doUpdate (Book Book) {
BookService. DoUpdate (book);
The return of "redirect: findBookByCondition";
}
}
[/code]
CodePudding user response:
Separation with ajax, or before and after the end, to be honest, redirect the back-end control front-end, poor user experience