Last change
on this file since 29600 was 29600, checked in by davidb, 9 years ago |
Restructuring of JSP code. Removes the Firefox JS Console error caused by having quotes with <script> tags that are produced by out.println() stagements at the top-level HTML file
|
File size:
1.0 KB
|
Line | |
---|
1 | <%
|
---|
2 | String docBase = getServletContext().getRealPath("/");
|
---|
3 | File similarityDir = new File(docBase,"similarity-2d");
|
---|
4 | File imagesDir = new File(similarityDir,"Images");
|
---|
5 |
|
---|
6 | ArrayList<File> imageFileList = listFilesForFolder(imagesDir,".gif");
|
---|
7 |
|
---|
8 | File imageUrlBase = new File("Images");
|
---|
9 |
|
---|
10 | String action = request.getParameter("action");
|
---|
11 |
|
---|
12 | out.println("<script>");
|
---|
13 | out.println("var dynamic_img_list = [ ");
|
---|
14 | boolean first_entry = true;
|
---|
15 | for (final File fileEntry : imageFileList) {
|
---|
16 | String flagImageUrl = imageUrlBase + "/" + fileEntry.getName();
|
---|
17 |
|
---|
18 | //out.println("<img src=\"" + flagImageUrl + "\">");
|
---|
19 | if (first_entry) {
|
---|
20 | out.println("\"" + flagImageUrl + "\"");
|
---|
21 | first_entry = false;
|
---|
22 | }
|
---|
23 | else {
|
---|
24 | out.println(",\"" + flagImageUrl + "\"");
|
---|
25 | }
|
---|
26 | }
|
---|
27 | out.println("];");
|
---|
28 |
|
---|
29 | out.println("is_jsp_active = true;");
|
---|
30 | out.println("img_list = dynamic_img_list;");
|
---|
31 |
|
---|
32 | out.println("</script>");
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | %>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.