KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > blogunity > web > actions > blog > FrontpageAction


1 /*
2  * $Id: FrontpageAction.java,v 1.3 2005/01/17 21:36:04 michelson Exp $
3  *
4  * Copyright (c) 2005 j2biz Group, http://www.j2biz.com Koeln / Duesseldorf ,
5  * Germany
6  *
7  * @author Max Kalina
8  *
9  *
10  * This program is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation; either version 2 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  * Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */

25
26 package com.j2biz.blogunity.web.actions.blog;
27
28 import java.util.List JavaDoc;
29
30 import javax.servlet.http.HttpServletRequest JavaDoc;
31 import javax.servlet.http.HttpServletResponse JavaDoc;
32
33 import com.j2biz.blogunity.dao.EntryDAO;
34 import com.j2biz.blogunity.exception.BlogunityException;
35 import com.j2biz.blogunity.pojo.Blog;
36 import com.j2biz.blogunity.web.ActionResultFactory;
37 import com.j2biz.blogunity.web.IActionResult;
38 import com.j2biz.blogunity.web.actions.AbstractAction;
39
40 public class FrontpageAction extends AbstractAction {
41
42     private Blog blog;
43
44     public FrontpageAction(Blog blog) {
45         this.blog = blog;
46     }
47
48     private static final IActionResult BLOG_FRONTPAGE_FORWARD = ActionResultFactory
49             .buildForward("/frontpageView.vm");
50
51     /*
52      * (non-Javadoc)
53      *
54      * @see com.j2biz.blogunity.web.actions.AbstractAction#execute(javax.servlet.http.HttpServletRequest,
55      * javax.servlet.http.HttpServletResponse)
56      */

57     public IActionResult execute(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
58             throws BlogunityException {
59
60         List JavaDoc entries = ( new EntryDAO()).getPaginatedEntries(blog.getUrlName(), 0, 20);
61
62         request.setAttribute("entries", entries);
63
64         return BLOG_FRONTPAGE_FORWARD;
65     }
66
67 }
Popular Tags