2 * AuthenticationAction.java created on 05.09.2003
4 * Copyright (C) 2001, 2002, 2003 The Mir-coders group
6 * This file is part of Mir.
8 * Mir is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Mir is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Mir; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * In addition, as a special exception, The Mir-coders gives permission to link
23 * the code of this program with any library licensed under the Apache Software License,
24 * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
25 * (or with modified versions of the above that use the same license as the above),
26 * and distribute linked combinations including the two. You must obey the
27 * GNU General Public License in all respects for all of the code used other than
28 * the above mentioned libraries. If you modify this file, you may extend this
29 * exception to your version of the file, but you are not obligated to do so.
30 * If you do not wish to do so, delete this exception statement from your version.
32 package mir.core.ui.action.admin;
34 import java.util.List;
36 import javax.servlet.ServletContext;
37 import javax.servlet.http.HttpServletRequest;
38 import javax.servlet.http.HttpServletResponse;
40 import mir.core.service.storage.ArticleTypeService;
41 import mir.core.service.storage.MessageService;
42 import mir.core.ui.servlet.ServletConstants;
43 import net.sf.hibernate.SessionFactory;
44 import net.sf.hibernate.expression.Order;
46 import org.apache.struts.action.Action;
47 import org.apache.struts.action.ActionForm;
48 import org.apache.struts.action.ActionForward;
49 import org.apache.struts.action.ActionMapping;
52 * AuthenticationAction
54 * @version $Id: StartpageAction.java,v 1.3 2003/12/20 20:27:09 idfx Exp $
56 public class StartpageAction extends Action {
59 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
61 public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm,
62 HttpServletRequest request, HttpServletResponse response)
65 String param = actionMapping.getParameter();
66 if(param.equals("index")){
67 return index(actionMapping, actionForm, request, response);
72 private ActionForward index(ActionMapping actionMapping, ActionForm actionForm,
73 HttpServletRequest request, HttpServletResponse response)
76 ServletContext context = this.getServlet().getServletContext();
77 MessageService messageService =
78 new MessageService((SessionFactory)context
79 .getAttribute(ServletConstants.SESSION_FACTORY));
80 ArticleTypeService articleTypeService =
81 new ArticleTypeService((SessionFactory)context
82 .getAttribute(ServletConstants.SESSION_FACTORY));
84 Order order = Order.desc("webdbCreate");
85 List messages = messageService.list(0, order);
86 request.setAttribute("messages", messages);
88 List articleTypes = articleTypeService.list();
89 request.setAttribute("articletypes", articleTypes);
91 return actionMapping.findForward("success");