package com.sterning.books.web.actions;
import java.util.Collection;
import com.sterning.books.model.Books;
import com.sterning.books.services.iface.IBooksService;
import com.sterning.commons.AbstractAction;
import com.sterning.commons.Pager;
import com.sterning.commons.PagerService;
public class BooksAction extends AbstractAction {
private IBooksService booksService;
private PagerService pagerService;
private Books book;
private Pager pager;
protected Collection availableItems;
protected String currentPage;
protected String pagerMethod;
protected String totalRows;
protected String bookId;
protected String queryName;
protected String queryValue;
protected String searchName;
protected String searchValue;
protected String queryMap;
public String list() throws Exception {
if(queryMap ==null||queryMap.equals("")){
}else{
String[] str=queryMap.split("~");
this.setQueryName(str[0]);
this.setQueryValue(str[1]);
}
System.out.println("asd"+this.getQueryValue());
int totalRow=booksService.getRows(this.getQueryName(),this.getQueryValue());
pager=pagerService.getPager(this.getCurrentPage(), this.getPagerMethod(), totalRow);
this.setCurrentPage(String.valueOf(pager.getCurrentPage()));
this.setTotalRows(String.valueOf(totalRow));
availableItems=booksService.getBooks(this.getQueryName(),this.getQueryValue(),pager.getPageSize(), pager.getStartRow());
this.setQueryName(this.getQueryName());
this.setQueryValue(this.getQueryValue());
this.setSearchName(this.getQueryName());
this.setSearchValue(this.getQueryValue());
return SUCCESS;
}
public String load() throws Exception {
if(bookId!=null)
book = booksService.getBook(bookId);
else
bookId=booksService.getMaxID();
return SUCCESS;
}
public String save() throws Exception {
if(this.getBook().getBookPrice().equals("")){
this.getBook().setBookPrice("0.0");
}
String id=this.getBook().getBookId();
Books book=booksService.getBook(id);
if(book == null)
booksService.addBook(this.getBook());
else
booksService.updateBook(this.getBook());
this.setQueryName(this.getQueryName());
this.setQueryValue(this.getQueryValue());
if(this.getQueryName()==null||this.getQueryValue()==null||this.getQueryName().equals("")||this.getQueryValue().equals("")){
}else{
queryMap=this.getQueryName()+"~"+this.getQueryValue();
}
return SUCCESS;
}
public String delete() throws Exception {
booksService.deleteBook(this.getBookId());
if(this.getQueryName()==null||this.getQueryValue()==null||this.getQueryName().equals("")||this.getQueryValue().equals("")){
}else{
queryMap=this.getQueryName()+"~"+this.getQueryValue();
}
return SUCCESS;
}
public Books getBook() {
return book;
}
public void setBook(Books book) {
this.book = book;
}
public IBooksService getBooksService() {
return booksService;
}
public void setBooksService(IBooksService booksService) {
this.booksService = booksService;
}
public Collection getAvailableItems() {
return availableItems;
}
public String getCurrentPage() {
return currentPage;
}
public void setCurrentPage(String currentPage) {
this.currentPage = currentPage;
}
public String getPagerMethod() {
return pagerMethod;
}
public void setPagerMethod(String pagerMethod) {
this.pagerMethod = pagerMethod;
}
public Pager getPager() {
return pager;
}
public void setPager(Pager pager) {
this.pager = pager;
}
public String getTotalRows() {
return totalRows;
}
public void setTotalRows(String totalRows) {
this.totalRows = totalRows;
}
public String getBookId() {
return bookId;
}
public void setBookId(String bookId) {
this.bookId = bookId;
}
public String getQueryName() {
return queryName;
}
public void setQueryName(String queryName) {
this.queryName = queryName;
}
public String getQueryValue() {
return queryValue;
}
public void setQueryValue(String queryValue) {
this.queryValue = queryValue;
}
public String getSearchName() {
return searchName;
}
public void setSearchName(String searchName) {
this.searchName = searchName;
}
public String getSearchValue() {
return searchValue;
}
public void setSearchValue(String searchValue) {
this.searchValue = searchValue;
}
public String getQueryMap() {
return queryMap;
}
public void setQueryMap(String queryMap) {
this.queryMap = queryMap;
}
public PagerService getPagerService() {
return pagerService;
}
public void setPagerService(PagerService pagerService) {
this.pagerService = pagerService;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于Struts2+Spring+Hibernate的整合开发案例(BOOKADMIN) (112个子文件)
BooksAction.class 6KB
BooksMapDao.class 4KB
BooksService.class 2KB
Books.class 2KB
Pager.class 2KB
SetCharacterEncodingFilter.class 2KB
Test.class 2KB
BooksMapDao$2.class 2KB
BooksMapDao$1.class 1KB
PublicUtil.class 1KB
PagerService.class 1014B
IBooksService.class 677B
BooksDao.class 638B
AbstractAction.class 330B
.classpath 2KB
Entries 262B
Entries 180B
Entries 97B
Entries 94B
Entries 67B
Entries 55B
Entries 53B
Entries 51B
Entries 50B
Entries 30B
Entries 17B
Entries 15B
spring.jar 2.57MB
struts2-core-2.0.6.jar 2.09MB
hibernate3.jar 1.88MB
freemarker-2.3.8.jar 784KB
mysql-connector-java-5.0.4-bin.jar 484KB
xwork-2.0.1.jar 442KB
antlr-2.7.2.jar 350KB
log4j-1.2.8.jar 344KB
dom4j-1.6.1.jar 307KB
cglib-2.1.3.jar 276KB
ehcache-1.3.0.jar 227KB
commons-collections-2.1.1.jar 171KB
commons-collections.jar 171KB
ognl-2.6.11.jar 164KB
commons-dbcp.jar 105KB
commons-dbcp-1.2.1.jar 105KB
commons-pool-1.2.jar 41KB
commons-pool.jar 41KB
commons-logging.jar 37KB
commons-logging-1.0.4.jar 37KB
asm.jar 26KB
jta.jar 9KB
struts2-spring-plugin-2.0.6.jar 8KB
BooksAction.java 5KB
BooksMapDao.java 5KB
BooksService.java 2KB
Books.java 2KB
Pager.java 2KB
SetCharacterEncodingFilter.java 1KB
Test.java 1005B
PublicUtil.java 892B
PagerService.java 775B
IBooksService.java 684B
BooksDao.java 675B
AbstractAction.java 138B
list.jsp 4KB
editBook.jsp 1KB
index.jsp 332B
MANIFEST.MF 39B
.mymetadata 301B
com.genuitec.eclipse.j2eedt.core.prefs 1KB
.project 1KB
log4j.properties 672B
log4j.properties 672B
BooksAction.properties 221B
BooksAction.properties 221B
Struts.properties 84B
Struts.properties 84B
Repository 51B
Repository 50B
Repository 48B
Repository 46B
Repository 45B
Repository 42B
Repository 42B
Repository 40B
Repository 40B
Repository 36B
Repository 35B
Repository 32B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
Root 37B
game.sql 596B
共 112 条
- 1
- 2
资源评论
- luobochaofan2013-09-18例子挺不错
- lixin2412012-04-04例子很小 里面内容很散碎 但也有参考价值
frog_
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第30题串联所有单词的子串.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第29题两数相除.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第28题找出字符串中第一个匹配项的下标.zip
- 实验报告模板(1).docx
- C语言基础-C语言编程基础之Leetcode编程题解之第26题删除有序数组中的重复项.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第25题K个一组翻转链表.zip
- hnu计算机系统作业-计算机系统基础课程大作业.zip
- 树莓派app.apk
- C++的基于同态加密技术的匿名电子投票系统源码.zip
- SW建模格式图.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功