comparison client/digitallibrary/dlInfo-json.jsp @ 753:39bd5128811c jquery

first real JSON jsp: ImgInfo-json.jsp
author robcast
date Sat, 05 Feb 2011 22:50:15 +0100
parents client/digitallibrary/dlInfo-js.jsp@bc9196347188
children
comparison
equal deleted inserted replaced
752:fce27a005445 753:39bd5128811c
1 <%@ page language="java" %>
2 <%!
3 // create DocumentBean instance for all JSP requests
4 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
5
6 // initialize DocumentBean instance in JSP init
7 public void jspInit() {
8 try {
9 // set servlet init-parameter
10 docBean.setConfig(getServletConfig());
11 } catch (javax.servlet.ServletException e) {
12 System.out.println(e);
13 }
14 }
15 %><%
16 // parsing the query
17 digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
18 docBean.setRequest(dlRequest);
19 %>
20 // JSON format metadata about request and image
21 {
22 <%
23 Object[] keys = dlRequest.getParams().keySet().toArray();
24 java.util.Arrays.sort(keys);
25 int l = keys.length;
26 for (int i = 0; i < l; i++) {
27 String key = (String) keys[i];
28 String val = dlRequest.getAsString(key);
29 if (val.length() == 0) {
30 val = "";
31 }
32 %>"<%= key %>" : "<%= val %>",
33 <%
34 }
35 %>
36 }