09_01.jsp
资源名称:EXT_study.rar [点击查看]
上传用户:zaktkj
上传日期:2022-08-08
资源大小:5770k
文件大小:1k
源码类别:
JavaScript
开发平台:
JavaScript
- <%
- String start = request.getParameter("start");
- String limit = request.getParameter("limit");
- String sort = request.getParameter("sort");
- String dir = request.getParameter("dir");
- System.out.println(dir);
- if (dir == null) {
- dir = "ASC";
- }
- try {
- int index = Integer.parseInt(start);
- int pageSize = Integer.parseInt(limit);
- String json = "{totalProperty:100,root:[";
- if (dir.equals("ASC")) {
- for (int i = index; i < pageSize + index; i++) {
- json += "{id:" + i + ",name:'name" + i + "',descn:'descn" + i + "'}";
- if (i != pageSize + index - 1) {
- json += ",";
- }
- }
- } else {
- for (int i = pageSize + index; i > index; i--) {
- json += "{id:" + i + ",name:'name" + i + "',descn:'descn" + i + "'}";
- if (i != index - 1) {
- json += ",";
- }
- }
- }
- json += "]}";
- response.getWriter().write(json);
- } catch(Exception ex) {
- }
- %>