📄 bookaction.java
字号:
package org.thj.bookstore.action;
import java.util.List;
import java.util.Map;
import org.thj.bookstore.service.IBookService;
import org.thj.bookstore.service.ICatalogService;
import org.thj.bookstore.util.Pager;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionSupport;
@SuppressWarnings("serial")
public class BookAction extends ActionSupport {
protected ICatalogService catalogService;
protected IBookService bookService;
protected Integer catalogid;
private Integer currentPage=1;
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getCatalogid() {
return catalogid;
}
public void setCatalogid(Integer catalogid) {
this.catalogid = catalogid;
}
public ICatalogService getCatalogService() {
return catalogService;
}
public void setCatalogService(ICatalogService catalogService) {
this.catalogService = catalogService;
}
public IBookService getBookService() {
return bookService;
}
public void setBookService(IBookService bookService) {
this.bookService = bookService;
}
@SuppressWarnings("unchecked")
public String browseCatalog() throws Exception {
List catalogs = catalogService.getAllCatalogs();
Map request = (Map)ActionContext.getContext().get("request");
request.put("catalogs",catalogs);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String browseBook() throws Exception {
int totalSize = bookService.getTotalByCatalogid(catalogid);
Pager pager = new Pager(currentPage,totalSize);
List books = bookService.getBookByCatalogid(catalogid, currentPage, pager.getPageSize());
Map request = (Map)ActionContext.getContext().get("request");
Map session = ActionContext.getContext().getSession();
session.put("catalogid",catalogid);
request.put("books",books);
request.put("pager",pager);
return SUCCESS;
}
public String searchBook() throws Exception {
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -