Template temp = getConfiguration().getTemplate("cityshop.ftl");
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
IDictionaryDao dictionaryDao = (IDictionaryDao) ac.getBean("dictionaryDao");
GatewayCategory gatewayCategory = gatewayService.findGatewayCategoryById(GatewayConstants.CTC_TCSJ);
root.put("gatewayCategory", gatewayCategory);
//同城商家类型
List<ProductVO> productVOs = gatewayService.initGatewayInfo(GatewayConstants.CTC_TCSJLX);
root.put("productVOs", productVOs);
// String orgId = request.getParameter("orgId");
IPObject iPObject = (IPObject) request.getSession().getAttribute("iPObject");
String pageno = request.getParameter("pageno1");
String county = request.getParameter("county");
String visibleType = request.getParameter("visibleType");
if(StringUtil.isEmptyStr(visibleType))
{
visibleType = "0";
}
root.put("visibleType", visibleType);
//处理当前页
if(pageno==null) {
pageno = "1";
}
int pagenum = 1;
try {
pagenum = Integer.parseInt(pageno);
} catch (Exception e1) {
pagenum = 1;
}
root.put("county", county);
PageList pageList = null;
IAdvertisementDao advertisementDao = (IAdvertisementDao) ac.getBean("advertisementDao");
pageList = advertisementDao.findAllAdvertisementByMerchant(iPObject==null?null:iPObject.getAreaNode(),county,"",pagenum,9);
root.put("pageList", pageList);
List<Dictionary> dictionarys = iPObject==null?null:dictionaryDao.listByKindAndCode("city", iPObject.getCode());
root.put("dictionarys", dictionarys);
/* 将模板和数据模型合并 */
Writer out = response.getWriter();
try {
temp.process(root, out);