BlogAction.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:2k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.opensource.blog.web.action;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.apache.struts.action.Action;
- import org.apache.struts.action.ActionForm;
- import org.apache.struts.action.ActionForward;
- import org.apache.struts.action.ActionMapping;
- import com.laoer.comm.web.PageList;
- import com.laoer.comm.web.Pages;
- import com.opensource.blog.service.ArticleService;
- import com.opensource.blog.service.BlogService;
- public class BlogAction
- extends Action {
- private BlogService blogService;
- private ArticleService articleService;
- public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm,
- HttpServletRequest servletRequest,
- HttpServletResponse servletResponse) {
- Pages pages = new Pages(servletRequest.getLocale());
- pages.setPage(1);
- pages.setPerPageNum(20);
- pages.setStyle(1);
- pages.setTotals(20);
- pages.setFileName("");
- PageList pl = this.getBlogService().findBlogAll(pages);
- servletRequest.setAttribute("bpl", pl);
- pl = this.getArticleService().findArticlesAll(pages);
- servletRequest.setAttribute("apl", pl);
- return actionMapping.findForward("blog");
- }
- public ArticleService getArticleService() {
- return articleService;
- }
- public BlogService getBlogService() {
- return blogService;
- }
- public void setArticleService(ArticleService articleService) {
- this.articleService = articleService;
- }
- public void setBlogService(BlogService blogService) {
- this.blogService = blogService;
- }
- }