Map<Object, Object> root = new HashMap<Object, Object>();
root.putAll(base);
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
String newsType = request.getParameter("newsType");
root.put("newsType", newsType);
String newsName = "新闻中心";
if("1".equals(newsType)||newsType==null)
{
newsName = "新闻中心";
}else if("2".equals(newsType))
{
newsName = "公告中心";
}else if("3".equals(newsType))
{
newsName = "新手上路";
}
root.put("newsName", newsName);
if("main".equals(type))
{
String newsId = request.getParameter("newsId");
News news = gatewayService.findById(Integer.parseInt(newsId));
root.put("news", news);
News upnews = gatewayService.findUpNewsByCurrId(newsType, Integer.parseInt(newsId));
root.put("upnews", upnews);
News downnews = gatewayService.findDownNewsByCurrId(newsType, Integer.parseInt(newsId));
root.put("downnews", downnews);
}else
{
String pageno = request.getParameter("pageno");
//处理当前页
if(pageno==null) {
pageno = "1";
}
int pagenum = 1;
try {
pagenum = Integer.parseInt(pageno);
} catch (Exception e1) {
pagenum = 1;
}
int pageSize = 15;
PageList pageList = gatewayService.findNewsByConditions(newsType, null, pagenum, pageSize);
if(pageList!=null&&pageList.getDataList()!=null)
{
root.put("pageList", pageList);
}