⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readerlookaction.java

📁 图书管理系统
💻 JAVA
字号:
package com.web.action;import static com.common.BeanFactory.getBean;import java.util.ArrayList;import java.util.List;import javax.servlet.http.HttpServletRequest;import org.apache.struts2.ServletActionContext;import com.bean.Book;import com.bean.BorrowBook;import com.bean.Reader;import com.opensymphony.xwork2.ActionSupport;import com.pojo.BorrowLookup;import com.service.BooksService;public class ReaderLookAction extends ActionSupport {	private Integer readerid;	private Integer bookid;	private List subBorrowBook;	private String bookname;	private String typeid;	private int currentPage = 1;	private int pageCount;	private int messageCount;		public String borrowLookup() throws Exception{		HttpServletRequest request = ServletActionContext.getRequest();		BooksService service = (BooksService)getBean("booksService");		List list = service.findReaderBorrowBook(readerid, bookid, null);		if(list==null)			return "success";		separatePage(list);		return "success";	}		public String bookLookup() throws Exception{		HttpServletRequest request = ServletActionContext.getRequest();		BooksService service = (BooksService)getBean("booksService");		List typeList = service.findBookType(null,null);		request.setAttribute("typeList", typeList);		if("".equals(typeid)||typeid==null)			typeid = "0";		Integer booktypeid = Integer.parseInt(typeid);		List list = service.findBooks(null, bookname, booktypeid);		if(list==null)			return "success";		separatePage(list);		return "success";	}	public Integer getReaderid() {		return readerid;	}	public void setReaderid(Integer readerid) {		this.readerid = readerid;	}	public Integer getBookid() {		return bookid;	}	public void setBookid(Integer bookid) {		this.bookid = bookid;	}		private void separatePage(List list){		if(list.isEmpty()){			messageCount = 0;			return;		}		messageCount = list.size();		if(list.size()%4==0)			pageCount = list.size()/4;		else			pageCount = list.size()/4 + 1;		if(list.size()>currentPage*4)			subBorrowBook = list.subList((currentPage-1)*4, currentPage*4);		else			subBorrowBook = list.subList((currentPage-1)*4, list.size());	}		public static void main(String[] args) throws Exception{		ReaderLookAction lookaction = new ReaderLookAction();	//	lookaction.setBooktype(2);//		lookaction.borrowLookup();		lookaction.bookLookup();	}	public List getSubBorrowBook() {		return subBorrowBook;	}	public void setSubBorrowBook(List subBorrowBook) {		this.subBorrowBook = subBorrowBook;	}	public int getCurrentPage() {		return currentPage;	}	public void setCurrentPage(int currentPage) {		this.currentPage = currentPage;	}	public int getPageCount() {		return pageCount;	}	public void setPageCount(int pageCount) {		this.pageCount = pageCount;	}	public int getMessageCount() {		return messageCount;	}	public void setMessageCount(int messageCount) {		this.messageCount = messageCount;	}	public String getBookname() {		return bookname;	}	public void setBookname(String bookname) {		this.bookname = bookname;	}	public String getTypeid() {		return typeid;	}	public void setTypeid(String typeid) {		this.typeid = typeid;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -