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

📄 newsaction.java

📁 EasyJF官网(www.easyjf.com)全站系统源码使用说明 全站源码是EasyJF开源团队站务组及核心成员共同开发及维护的系统
💻 JAVA
字号:
package com.easyjf.news.action;

import com.easyjf.bbs.business.BBSUtil;
import com.easyjf.news.business.MessageModule;
import com.easyjf.news.business.NewsUtil;
import com.easyjf.news.business.NewsDir;
import com.easyjf.news.business.NewsDoc;
import com.easyjf.news.business.SiteLinkTool;
import com.easyjf.util.CommUtil;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.AbstractCmdAction;
import com.easyjf.web.tools.IPageList;

public class NewsAction extends AbstractCmdAction {	
	public Page doInit(WebForm form, Module module) {
		// TODO Auto-generated method stub
		return doHome(form,module);
	}
	public Page doHome(WebForm form, Module module) {
		IPageList pList=BBSUtil.queryMessage("eliteMessage>0",15,1);
		if(pList!=null)form.addResult("bbsList",pList.getResult());
		return new Page("home","/news/index.html","template");
	}
	public Page doAnnounce(WebForm form, Module module) {
		form.addResult("dirPath","首页->网站公告");
		NewsDir dir=NewsDir.readBySn("announce");
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=NewsUtil.pageList(dir,currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("announce","/news/newsList.html","template");		
	}	
	public Page doDocs(WebForm form, Module module) {		
		form.addResult("dirPath","首页->技术资料");
		NewsDir dir=NewsDir.readBySn("docs");
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=NewsUtil.pageList(dir,currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("docs","/news/newsList.html","template");
	}	
	public Page doTutorial(WebForm form, Module module) {		
		form.addResult("dirPath","首页->技术资料");
		NewsDir dir=NewsDir.readBySn("tutorial");
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=NewsUtil.pageList(dir,currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("tutorial","/news/tutorial.html","template");
	}
	public Page doFramework(WebForm form, Module module) {		
		form.addResult("dirPath","首页->框架设计");
		NewsDir dir=NewsDir.readBySn("frameworks");
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=NewsUtil.pageList(dir,currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("framework","/news/frameworks.html","template");
	}	
	public Page doDownload(WebForm form, Module module) {		
		form.addResult("dirPath","首页->源码/下载");
		NewsDir dir=NewsDir.readBySn("download");
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=NewsUtil.pageList(dir,currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("download","/news/download.html","template");
	}	
	public Page doComponent(WebForm form, Module module) {
		
		return new Page("announce","/news/newsList.html","template");
	}	
	public Page doMyrss(WebForm form, Module module) {		
		return new Page("announce","/news/newsList.html","template");
	}	
	public Page doNewsList(WebForm form, Module module) {
		form.addResult("dirPath","首页->移民动态");
		NewsDir dir=NewsDir.readBySn("news");
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=NewsUtil.pageList(dir,currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("newlist","/news/newsList.html","template");
	}
	
	public Page doLeaderMail(WebForm form, Module module) {
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=MessageModule.pageList("leaderMail",currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);	
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("leaderMail","/news/leaderMessage.html","template");
	}
	public Page doGuestbook(WebForm form, Module module) {
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));		
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=MessageModule.pageList("",currentPage,pageSize);
		CommUtil.saveIPageList2WebForm(pList,form);
		if(pList!=null)form.addResult("pageSize",new Integer(pageSize));
		return new Page("guestbook","/news/guestbook.html","template");
	}
	public Page doShow(WebForm form, Module module) {
		String cid=CommUtil.null2String(form.get("cid"));
		NewsDoc obj=NewsDoc.read(cid);
		form.addPo(obj);
		return new Page("show","/news/show.html","template");
	}
	public Object doAfter(WebForm form, Module module) {
		// TODO Auto-generated method stub
		super.doAfter(form, module);
		String isPublish=CommUtil.null2String(form.get("publish"));
		SiteLinkTool siteLink=new SiteLinkTool();
		if(!isPublish.equals(""))
		{
			siteLink.setTypes(1);
		}
		form.addResult("SiteLink",siteLink);	
		form.addResult("NewsUtil",NewsUtil.getInstance());
		return null;
	}	
}

⌨️ 快捷键说明

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