📄 viewforumlistaction.java
字号:
/* * XP Forum * * Copyright (c) 2002-2003 RedSoft Group. All rights reserved. * */package org.redsoft.forum.web;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 org.redsoft.forum.dao.DAOFactory;import org.redsoft.forum.dao.ForumDAO;import org.redsoft.forum.dao.ThreadDAO;import org.redsoft.forum.exception.CategoryNotFoundException;import org.redsoft.forum.exception.DAOException;import javax.servlet.ServletException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import java.io.IOException;import java.util.Collection;/** * View all the forums and a few of threads as specified * * @author Charles Huang * * @version $Id: ViewForumListAction.java,v 1.1.1.1 2004/02/04 03:52:13 mustang Exp $ */public class ViewForumListAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { final ThreadDAO dao = DAOFactory.getInstance().getThreadDAO(); try{ ForumDAO forumDAO = DAOFactory.getInstance().getForumDAO(); Forum[] forums = forumDAO.getForumCategory(); // Get a list of forums for( int forumID = 1; forumID <= forums.length; forumID++ ){ Collection threads = dao.findByCategory( forumID, 1, 8 ); request.setAttribute( "Forum_" + forumID, threads ); } } catch( final CategoryNotFoundException categoryNotFoundException ){ categoryNotFoundException.printStackTrace(); return (mapping.findForward("error")); } catch (DAOException daoe) { daoe.printStackTrace(); return (mapping.findForward("error")); } // Forward control to the specified success URI return (mapping.findForward("success")); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -