public List<Article> generateArticles(HttpServletRequest request) { Enumeration<String> parmNames = request.getParameterNames(); List<Article> articleList = new ArrayList<Article>(); Article article0 = new Article(); Article article1 = new Article(); Article article2 = new Article(); Article article3 = new Article(); Article article4 = new Article(); Article article5 = new Article(); Article article6 = new Article(); Article article7 = new Article(); log.info("***********上送参数列表 start *****************"); while (parmNames.hasMoreElements()) { String key = parmNames.nextElement(); log.info("【" + key + "】" + request.getParameter(key)); if (key.contains("thumb_media")) { continue; } switch (key.substring(key.lastIndexOf('_') + 1)) { case "0": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article0.setTitle(request.getParameter(key)); break; case "author": article0.setAuthor(request.getParameter(key)); break; case "content": article0.setContent(request.getParameter(key)); break; case "content_source_url": article0.setContent_source_url(request.getParameter(key)); break; case "digest": article0.setDigest(request.getParameter(key)); break; case "show_cover_pic": article0.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("其他参数 【" + key + "】" + request.getParameter(key)); break; } break; case "1": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article1.setTitle(request.getParameter(key)); break; case "author": article1.setAuthor(request.getParameter(key)); break; case "content": article1.setContent(request.getParameter(key)); break; case "content_source_url": article1.setContent_source_url(request.getParameter(key)); break; case "digest": article1.setDigest(request.getParameter(key)); break; case "show_cover_pic": article1.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("其他参数 【" + key + "】" + request.getParameter(key)); break; } break; case "2": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article2.setTitle(request.getParameter(key)); break; case "author": article2.setAuthor(request.getParameter(key)); break; case "content": article2.setContent(request.getParameter(key)); break; case "content_source_url": article2.setContent_source_url(request.getParameter(key)); break; case "digest": article2.setDigest(request.getParameter(key)); break; case "show_cover_pic": article2.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("无效参数 【" + key + "】" + request.getParameter(key)); break; } break; case "3": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article3.setTitle(request.getParameter(key)); break; case "author": article3.setAuthor(request.getParameter(key)); break; case "content": article3.setContent(request.getParameter(key)); break; case "content_source_url": article3.setContent_source_url(request.getParameter(key)); break; case "digest": article3.setDigest(request.getParameter(key)); break; case "show_cover_pic": article3.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("无效参数 【" + key + "】" + request.getParameter(key)); break; } break; case "4": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article4.setTitle(request.getParameter(key)); break; case "author": article4.setAuthor(request.getParameter(key)); break; case "content": article4.setContent(request.getParameter(key)); break; case "content_source_url": article4.setContent_source_url(request.getParameter(key)); break; case "digest": article4.setDigest(request.getParameter(key)); break; case "show_cover_pic": article4.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("无效参数 【" + key + "】" + request.getParameter(key)); break; } break; case "5": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article5.setTitle(request.getParameter(key)); break; case "author": article5.setAuthor(request.getParameter(key)); break; case "content": article5.setContent(request.getParameter(key)); break; case "content_source_url": article5.setContent_source_url(request.getParameter(key)); break; case "digest": article5.setDigest(request.getParameter(key)); break; case "show_cover_pic": article5.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("无效参数 【" + key + "】" + request.getParameter(key)); break; } break; case "6": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article6.setTitle(request.getParameter(key)); break; case "author": article6.setAuthor(request.getParameter(key)); break; case "content": article6.setContent(request.getParameter(key)); break; case "content_source_url": article6.setContent_source_url(request.getParameter(key)); break; case "digest": article6.setDigest(request.getParameter(key)); break; case "show_cover_pic": article6.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("无效参数 【" + key + "】" + request.getParameter(key)); break; } break; case "7": switch (key.substring(0, key.lastIndexOf('_'))) { case "title": article7.setTitle(request.getParameter(key)); break; case "author": article7.setAuthor(request.getParameter(key)); break; case "content": article7.setContent(request.getParameter(key)); break; case "content_source_url": article7.setContent_source_url(request.getParameter(key)); break; case "digest": article7.setDigest(request.getParameter(key)); break; case "show_cover_pic": article7.setShow_cover_pic(Integer.parseInt(request.getParameter(key))); break; default: log.info("无效参数 【" + key + "】" + request.getParameter(key)); break; } break; default: break; } } log.info("***********上送参数列表 end *****************"); articleList.add(article0); articleList.add(article1); articleList.add(article2); articleList.add(article3); articleList.add(article4); articleList.add(article5); articleList.add(article6); articleList.add(article7); return articleList; }