root.put("page", page);
} else {
}*/
String code = request.getParameter("productid");
PageList page = gatewayService.findProductPageByCode(code, pagenum, Constants.PRODUCT_LIST_SIZE);
if(page!=null&&page.getDataList().size()>0) {
root.put("page", page);
}
} else {
String keyword = request.getParameter("keyword");
//处理关键字
String[] keys = null;
if(keyword!=null) {
keyword = keyword.trim();
}
if(keyword==null||"".equals(keyword)) {
keys = null;
} else {
root.put("keyword", keyword);
if(keyword.indexOf(" ")>0) {
String[] keywords = keyword.split(" ");
keys = new String[keywords.length+1];
keys[0] = keyword;
for(int i=1;i<keys.length;i++) {
keys[i] = keywords[i-1];
}
} else {
keys = new String[]{keyword };
}
}
String areaCategoryId = request.getParameter("areaCategoryId");
root.put("areaCategoryId", areaCategoryId);
String categoryId = request.getParameter("categoryId");
root.put("categoryId", categoryId);
long aid = -1;
long cid = -1;
try {
aid = Long.parseLong(areaCategoryId);
} catch (Exception e) {
aid = -1;
}
try {
cid = Long.parseLong(categoryId);
} catch (Exception e) {
cid = -1;
}
String keytype = request.getParameter("keytype");
root.put("keytype", keytype);
if(keytype==null) {
keytype = "1";
}
PageList page = gatewayService.findProductPage(aid, cid, keytype, keys, pagenum, Constants.PRODUCT_LIST_SIZE);
if(page!=null&&page.getDataList().size()>0) {
root.put("page", page);
}
}
/* 将模板和数据模型合并 */
Writer out = response.getWriter();