source: other-projects/nz-flag-design/trunk/main-form/kiwiana/list-kiwiana.jsp@ 29964

Last change on this file since 29964 was 29964, checked in by davidb, 9 years ago

Generates dynamic list of kiwiana images to use

File size: 1.0 KB
RevLine 
[29964]1 <%
2 String docBase = getServletContext().getRealPath("/");
3 File mainFormDir = new File(docBase,"main-form");
4
5 String imagesStr = "kiwiana";
6 File imagesDir = new File(mainFormDir,imagesStr);
7
8 ArrayList<File> imageFileList = listFilesForFolder(imagesDir,"svg");
9
10 //File imageUrlBase = new File(imagesStr);
11 File imageUrlBase = new File(".");
12
13 //String action = request.getParameter("action");
14
15 out.println("<script>");
16 out.println("var dynamic_img_list = [ ");
17 boolean first_entry = true;
18 for (final File fileEntry : imageFileList) {
19 String flagImageUrl = imageUrlBase + "/" + fileEntry.getName();
20
21 if (first_entry) {
22 out.println("\"" + flagImageUrl + "\"");
23 first_entry = false;
24 }
25 else {
26 out.println(",\"" + flagImageUrl + "\"");
27 }
28 }
29 out.println("];");
30
31 out.println("is_jsp_active = true;");
32 out.println("img_list = dynamic_img_list;");
33
34 out.println("</script>");
35
36 %>
Note: See TracBrowser for help on using the repository browser.