@SuppressWarnings("unchecked")
 public ActionForward fromAttachments(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   try {
     if (submitCheck(request, "searchsubmit")) {
       AttachmentsForm attachementsForm = null;
       HttpSession session = request.getSession();
       if (form != null) {
         Map<String, String> settings = ForumInit.settings;
         int currentpage = 1;
         String page = request.getParameter("page");
         currentpage = page == null || page.equals("") ? 1 : Integer.valueOf(page.trim());
         attachementsForm = (AttachmentsForm) form;
         String sql = attachmentsService.findByAttachmentsForm(attachementsForm);
         List<Map<String, String>> count =
             dataBaseService.executeQuery("select count(*) as count " + sql);
         int totalsize = Common.toDigit(count.get(0).get("count"));
         int currpage = currentpage;
         LogPage loginpage = new LogPage(totalsize, 10, currpage);
         if (currentpage > loginpage.getTotalPage()) {
           currentpage = loginpage.getTotalPage();
         }
         int beginsize = (currentpage - 1) * 10;
         session.setAttribute("attaforms", attachementsForm);
         List<Map<String, String>> list =
             dataBaseService.executeQuery(
                 "select a.aid,a.filename,a.attachment,a.downloads,a.remote,a.filesize,p.fid,p.author,t.tid,t.subject,f.name "
                     + sql
                     + " limit "
                     + beginsize
                     + ",10");
         if (list != null && list.size() > 0) {
           List<Map<String, String>> showlist = new ArrayList<Map<String, String>>();
           String path = JspRunConfig.realPath + settings.get("attachdir") + "/";
           Map<String, String> ftpmap = dataParse.characterParse(settings.get("ftp"), false);
           String attachurl = ftpmap.get("attachurl");
           ftpmap = null;
           for (Map<String, String> map : list) {
             if (map.get("remote").equals("1")) {
               File file = new File(attachurl + "/" + map.get("attachment"));
               if (!file.exists()) {
                 map.put("nomatched", getMessage(request, "a_post_attachments_far"));
               }
               map.put("attachment", attachurl + "/" + map.get("attachment"));
             } else {
               File file = new File(path + map.get("attachment"));
               if (!file.exists()) {
                 map.put("nomatched", getMessage(request, "a_post_attachments_lost"));
               }
               map.put("attachment", map.get("attachment"));
             }
             if (attachementsForm.getNomatched() == 0
                 || (attachementsForm.getNomatched() == 1 && map.get("nomatched") != null)) {
               showlist.add(map);
             }
           }
           request.setAttribute("showlist", showlist);
         } else {
           request.setAttribute("showlist", list);
         }
         request.setAttribute("logpage", loginpage);
       }
       short groupid = (Short) session.getAttribute("jsprun_groupid");
       Members member = (Members) session.getAttribute("user");
       request.setAttribute(
           "forumselect",
           Common.forumselect(
               false,
               false,
               groupid,
               member != null ? member.getExtgroupids() : "",
               attachementsForm.getInforum() + ""));
       request.setAttribute("notfirst", "notfirst");
       return mapping.findForward("toAttachments");
     }
   } catch (Exception e) {
     request.setAttribute("message", e.getMessage());
     return mapping.findForward("message");
   }
   Common.requestforward(response, "admincp.jsp?action=attachments");
   return null;
 }