📄 list.java
字号:
/*
* List.java
*
* Created on 2007年3月17日, 下午4:34
*/
package News.Struts.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import News.ProcessData.ListModel;
import News.Struts.ActionForm.MapActionForm;
/**
*
* @author Owner
* @version
*/
public class List extends DispatchAction {
public ActionForward ListLinks(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id=request.getParameter("showPage");
ListModel LM=new ListModel();
ArrayList al=LM.listLinks(id);
if(al!=null)
{
request.getSession(true).setAttribute("linkInfo",al);
request.getSession(true).setAttribute("showPage",String.valueOf(LM.getShowPage()));
request.getSession(true).setAttribute("frontPage",String.valueOf(LM.getFrontPage()));
request.getSession(true).setAttribute("nextPage",String.valueOf(LM.getNextPage()));
request.getSession(true).setAttribute("recordCount",String.valueOf(LM.getRecordCount()));
request.getSession(true).setAttribute("pageCount",String.valueOf(LM.getPageCount()));
return mapping.findForward("Links");
}else { return mapping.findForward("failure");}
}
/**
* This is the Struts action method called on
* http://.../actionPath?method=myAction1,
* where "method" is the value specified in <action> element :
* ( <action parameter="method" .../> )
*/
public ActionForward ListCatalogs(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id=request.getParameter("showPage");
ListModel LM=new ListModel();
ArrayList al=LM.listCatalogs(id);
if(al!=null)
{
request.getSession(true).setAttribute("catalogInfo",al);
request.getSession(true).setAttribute("showPage",String.valueOf(LM.getShowPage()));
request.getSession(true).setAttribute("frontPage",String.valueOf(LM.getFrontPage()));
request.getSession(true).setAttribute("nextPage",String.valueOf(LM.getNextPage()));
request.getSession(true).setAttribute("recordCount",String.valueOf(LM.getRecordCount()));
request.getSession(true).setAttribute("pageCount",String.valueOf(LM.getPageCount()));
return mapping.findForward("Catalogs");
}else { return mapping.findForward("failure");}
}
/**
* This is the Struts action method called on
* http://.../actionPath?method=myAction2,
* where "method" is the value specified in <action> element :
* ( <action parameter="method" .../> )
*/
public ActionForward ListNotices(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id=request.getParameter("showPage");
ListModel LM=new ListModel();
ArrayList al=LM.listNotices(id);
if(al!=null)
{
request.getSession(true).setAttribute("noticeInfo",al);
request.getSession(true).setAttribute("showPage",String.valueOf(LM.getShowPage()));
request.getSession(true).setAttribute("frontPage",String.valueOf(LM.getFrontPage()));
request.getSession(true).setAttribute("nextPage",String.valueOf(LM.getNextPage()));
request.getSession(true).setAttribute("recordCount",String.valueOf(LM.getRecordCount()));
request.getSession(true).setAttribute("pageCount",String.valueOf(LM.getPageCount()));
return mapping.findForward("Notices");
}else { return mapping.findForward("failure");}
}
public ActionForward ListNews(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
MapActionForm maf=(MapActionForm)form;
String id=String.valueOf(maf.getId());
String key=maf.getTitle();
String keywords="%"+maf.getKeywords()+"%";
ListModel LM=new ListModel();
ArrayList al=LM.listNews(id,key,keywords);
if(al!=null)
{
request.getSession(true).setAttribute("newsInfo",al);
request.getSession(true).setAttribute("showPage",String.valueOf(LM.getShowPage()));
request.getSession(true).setAttribute("frontPage",String.valueOf(LM.getFrontPage()));
request.getSession(true).setAttribute("nextPage",String.valueOf(LM.getNextPage()));
request.getSession(true).setAttribute("recordCount",String.valueOf(LM.getRecordCount()));
request.getSession(true).setAttribute("pageCount",String.valueOf(LM.getPageCount()));
}
else {
request.getSession().removeAttribute("newsInfo");
}
request.getSession(true).setAttribute("key",maf.getTitle());
request.getSession(true).setAttribute("keywords",maf.getKeywords());
return mapping.findForward("News");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -