package com.zjjy.blog.action.admin; import java.util.List; import java.util.Map; import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; import com.zjjy.blog.dao.IArticleDao; import com.zjjy.blog.dao.IUserDao; import com.zjjy.blog.factory.DaoFactory; import com.zjjy.blog.pojo.Article; import com.zjjy.blog.pojo.User; @SuppressWarnings({ “unchecked“ “unused“ }) public class BlogAction extends ActionSupport implements SessionAware { private static final long serialVersionUID = 1L; private IArticleDao articleDao = (IArticleDao) DaoFactory.instance().getDao( “ArticleDao“); private IUserDao userDao = (IUserDao) DaoFactory.instance().getDao(“UserDao“); private Map session; private User user; private int pageSize; private int pageNumber; private String number; private int totalNumber; private List articles; @Override public String execute() throws Exception { user = userDao.getUserByName(((User) session.get(“SESSION_USER“)) .getUserName()); if (user == null) { this.addActionerror(this.getText(“actionerror.nologin“)); return LOGIN; } this.setPageSize(user.getPageArticleNumber()); this.setPageNumber(1); if (user.getArticles().size() % this.getPageSize() == 0) { this.totalNumber = user.getArticles().size() / this.getPageSize(); } else { this.totalNumber = user.getArticles().size() / this.getPageSize() + 1; } articles = articleDao.getArticlesPaginationByUserId(pageSize pageNumber user.getUserId()); return SUCCESS; } public String pagination() throws Exception { user = userDao.getUserByName(((User) session.get(“SESSION_USER“)) .getUserName()); if (user == null) { this.addActionerror(this.getText(“actionerror.nologin“)); return LOGIN; } this.setPageSize(user.getPageArticleNumber()); if (user.getArticles().size() % this.getPageSize() == 0) { this.totalNumber = user.getArticles().size() / this.getPageSize(); } else { this.totalNumber = user.getArticles().size() / this.getPageSize() + 1; } // 转换输入过来的数据 // try { // if (number != null && !number.trim().equals(““)) { // pageNumber = Integer.valueOf(pageNumber); // if (pageNumber < 1) { // pageNumber = 1; // } // if (pageNumber > totalNumber) { // pageNumber = totalNumber; // } // } // } catch (Exception e) { // System.out.println(“类型转换失败“); // pageNumber = 1; // } articles = articleDao.getArticlesPaginationByUserId(pageSize pageNumber user.getUserId()); return SUCCESS; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public void setSession(Map arg0) { this.session = arg0; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getPageNumber() { return pageNumbe
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-05-17 09:03 MyBlog\
文件 2181 2009-08-20 00:11 MyBlog\.classpath
目录 0 2010-05-17 09:03 MyBlog\.myeclipse\
文件 563 2009-08-13 17:46 MyBlog\.myhibernatedata
文件 292 2010-05-17 09:03 MyBlog\.myme
tadata 文件 1614 2009-08-14 02:01 MyBlog\.project 目录 0 2010-05-17 09:03 MyBlog\.settings\ 文件 500 2009-08-13 17:44 MyBlog\.settings\.jsdtscope 文件 205 2009-08-18 00:38 MyBlog\.settings\com.genuitec.eclipse.core.prefs 文件 1040 2009-08-14 16:50 MyBlog\.settings\com.genuitec.eclipse.j2eedt.core.prefs 文件 178 2010-05-17 09:08 MyBlog\.settings\org.eclipse.core.resources.prefs 文件 49 2009-08-13 17:44 MyBlog\.settings\org.eclipse.wst.jsdt.ui.superType.container 文件 6 2009-08-13 17:44 MyBlog\.settings\org.eclipse.wst.jsdt.ui.superType.name 目录 0 2010-05-17 09:03 MyBlog\doc\ 文件 36352 2009-08-14 16:32 MyBlog\doc\blog.doc 文件 2536 2010-05-17 13:10 MyBlog\doc\myblog.sql 目录 0 2010-05-17 09:03 MyBlog\src\ 目录 0 2010-05-17 09:03 MyBlog\src\com\ 目录 0 2010-05-17 09:03 MyBlog\src\com\zjjy\ 目录 0 2010-05-17 09:03 MyBlog\src\com\zjjy\blog\ 目录 0 2010-05-17 09:03 MyBlog\src\com\zjjy\blog\action\ 目录 0 2010-05-17 09:03 MyBlog\src\com\zjjy\blog\action\admin\ 文件 5968 2009-08-20 00:04 MyBlog\src\com\zjjy\blog\action\admin\admin-action.xml 文件 3556 2010-05-17 09:09 MyBlog\src\com\zjjy\blog\action\admin\BlogAction.java 文件 819 2009-08-19 14:22 MyBlog\src\com\zjjy\blog\action\admin\BlogAddAction-validation.xml 文件 2186 2010-05-17 09:10 MyBlog\src\com\zjjy\blog\action\admin\BlogAddAction.java 文件 1331 2010-05-17 09:10 MyBlog\src\com\zjjy\blog\action\admin\BlogInputAction.java 文件 3810 2010-05-17 09:10 MyBlog\src\com\zjjy\blog\action\admin\CategoryAction.java 文件 912 2010-05-17 09:11 MyBlog\src\com\zjjy\blog\action\admin\CategoryToInputAction.java 文件 4299 2010-05-17 09:11 MyBlog\src\com\zjjy\blog\action\admin\CommentAction.java 文件 3370 2010-05-17 09:11 MyBlog\src\com\zjjy\blog\action\admin\CommentInputNumberAction.java ............此处省略534个文件信息
评论
共有 条评论