7388927fe8b38dcf3788614c9ff97658843eea8c.svn-base 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <%
  2. String begin=request.getParameter("start");
  3. String size=request.getParameter("limited");
  4. String callback=request.getParameter("callback");
  5. try{
  6. int index = Integer.parseInt(begin);
  7. int pageSize = Integer.parseInt(size);
  8. /*
  9. <?
  10. $dir = "images/thumbs/";
  11. $images = array();
  12. $d = dir($dir);
  13. while($name = $d->read()){
  14. if(!preg_match('/\.(jpg|gif|png)$/', $name))
  15. continue;
  16. $size = filesize($dir.$name);
  17. $lastmod = filemtime($dir.$name)*1000;
  18. $images[] = array('name'=>$name, 'size'=>$size,
  19. 'lastmod'=>$lastmod, 'url'=>$dir.$name);
  20. }
  21. $d->close();
  22. $o = array('images'=>$images);
  23. echo
  24. json_encode($o);
  25. ?>
  26. */
  27. String json = callback+"({totalProperty:100,root:[";
  28. for (int i = index; i < pageSize + index; i++) {
  29. json += "{col1:" + i + ",col2: '<a href=\"www.sohu.com\" target=_blank >name</a>" + i + "', col3:'descn" + i + "'}";
  30. if (i != pageSize + index - 1) {
  31. json += ",";
  32. }
  33. }
  34. json += "]});";
  35. System.out.println();
  36. System.out.println(json);
  37. System.out.println();
  38. response.getWriter().write(json);
  39. }catch(Exception e){
  40. }
  41. %>