⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainindex.java

📁 新闻发布系统
💻 JAVA
字号:
/*
 * MainIndex.java
 *
 * Created on 2007年3月22日, 上午8:32
 */

package News.Struts.Action;

import News.ProcessData.SingleRecordModel;
import News.Struts.ActionForm.SiteSettingActionForm;
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.ActionMapping;
import org.apache.struts.action.ActionForward;

import News.GUI.Data.Catalog;
import News.Common.News;
import java.util.*;
import News.GUI.ProcessData.List;
/**
 *
 * @author Owner
 * @version
 */

public class MainIndex extends Action {
   
    
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        List l=new List();
        ArrayList title=new ArrayList();
        ArrayList news=new ArrayList();
        ArrayList links=new ArrayList();
        ArrayList ca=l.getAllNewsCatalogs();
        Iterator li=ca.listIterator();
        while(li.hasNext())
        {
            Catalog catalog=(Catalog)li.next();
            title.add(catalog);
            Iterator lt=l.getAllNews(catalog.getId(),5,catalog.getTitle()).listIterator();
            while(lt.hasNext())
            {
                News n=(News)lt.next();
    
                news.add(n);
            }
        }
        links=l.getAllLinks();
        if(!links.isEmpty())
        {
            request.getSession(true).setAttribute("link",links);
        }
        SiteSettingActionForm site=l.SiteSettingRecord();
         if(site!=null)
        {
            request.getSession(true).setAttribute("site",site);
        }
        ArrayList alt=l.getAllNotices();
        if(!alt.isEmpty())
        {
            request.getSession(true).setAttribute("notice",alt);
        }
        request.getSession(true).setAttribute("title",title);
        request.getSession(true).setAttribute("news",news);
        return mapping.findForward("index");
        
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -