package book.com.cn.action; import book.com.cn.bean.Book; import book.com.cn.service.BookService; import com.opensymphony.xwork2.ActionSupport; public class AddBookAction extends ActionSupport { private String name, author,publisher; private int id; private BookService bookService; // 业务逻辑处理组件,用接口定义,不用类定义 public int getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } 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 BookService getBookService() { return bookService; } public void setBookService(BookService bookService) { this.bookService = bookService; } public void setId(int id) { this.id = id; } public String execute() throws Exception { Book book = new Book(); book.setId(id); book.setName(name); book.setAuthor(author); book.setPublisher(publisher); if (bookService.addBook(book)) return SUCCESS; else return ERROR; } }
最近下载更多
fffffffanan LV1
3月2日
微信网友_6248713511227392 LV11
2022年12月5日
ming_123_9715 LV23
2022年12月4日
漫长的白日梦 LV8
2021年12月8日
liuyanmei LV3
2021年5月19日
zxygcl LV5
2020年6月26日
zhaoxiangli LV2
2020年6月24日
menghailan LV4
2020年5月17日
恣意ah LV7
2020年1月2日
liuqinmin LV1
2019年12月22日