root/other-projects/nz-flag-design/trunk/similarity-2d/list-flags.jsp @ 29906

Revision 29906, 1.1 KB (checked in by davidb, 4 years ago)

Changes resulting from writing the TPDL submission

Line 
1  <%
2      String docBase = getServletContext().getRealPath("/");
3      File similarityDir = new File(docBase,"similarity-2d");
4
5      String imagesStr = (request.getParameter("imagesDir")!=null) ? request.getParameter("imagesDir") : "import";
6      File imagesDir = new File(similarityDir,imagesStr);
7
8      ArrayList<File> imageFileList = listFilesForFolderRE(imagesDir,".*\\.(gif|jpg|jpeg|png)$");
9
10      File imageUrlBase = new File(imagesStr);
11
12      //String action = request.getParameter("action");
13
14      out.println("<script>");
15      out.println("var dynamic_img_list = [ ");
16      boolean first_entry = true;
17      for (final File fileEntry : imageFileList) {
18          String flagImageUrl = imageUrlBase + "/" + fileEntry.getName();
19
20          if (first_entry) {
21              out.println("\"" + flagImageUrl + "\"");
22              first_entry = false;
23          }
24          else {
25              out.println(",\"" + flagImageUrl + "\"");
26          }
27      }
28      out.println("];");
29
30      out.println("is_jsp_active = true;");
31      out.println("img_list = dynamic_img_list;");
32
33      out.println("</script>");
34
35   %>
Note: See TracBrowser for help on using the browser.