1.jsp
上传用户:zaktkj
上传日期:2022-08-08
资源大小:5770k
文件大小:2k
源码类别:

JavaScript

开发平台:

JavaScript

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%
  3.     String ctx = request.getContextPath();
  4.     String ext = ctx + "/../ext-2.0";
  5.     pageContext.setAttribute("ctx", ctx);
  6.     pageContext.setAttribute("ext", ext);
  7. %>
  8. <html>
  9.     <head>
  10.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11.         <title>无侵入式整合dwr和ext</title>
  12.         <link rel="stylesheet" type="text/css" href="${ext}/resources/css/ext-all.css" />
  13.         <script type="text/javascript" src="${ext}/adapter/ext/ext-base.js"></script>
  14.         <script type="text/javascript" src="${ext}/ext-all.js"></script>
  15.         <script type="text/javascript" src="${ctx}/dwr/interface/infoManager.js"></script>
  16.         <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
  17.         <script type="text/javascript">
  18. Ext.BLANK_IMAGE_URL = '${ext}/resources/images/default/s.gif';
  19. Ext.onReady(function(){
  20.     var cm = new Ext.grid.ColumnModel([
  21.         {header:'编号',dataIndex:'id'},
  22.         {header:'名称',dataIndex:'name'},
  23.         {header:'性别',dataIndex:'sex'},
  24.         {header:'邮箱',dataIndex:'email'},
  25.         {header:'电话',dataIndex:'tel'},
  26.         {header:'添加时间',dataIndex:'addTime'},
  27.         {header:'备注',dataIndex:'descn'}
  28.     ]);
  29.     var store = new Ext.data.JsonStore({
  30.         fields: ["id","name","sex",'email','tel','addTime','descn']
  31.     });
  32.     // 调用dwr取得数据
  33.     infoManager.getResult(function(data) {
  34.         store.loadData(data);
  35.     });
  36.     var grid = new Ext.grid.GridPanel({
  37.         renderTo: 'grid',
  38.         store: store,
  39.         cm: cm
  40.     });
  41. });
  42.         </script>
  43.     </head>
  44.     <body>
  45.         <h1>无侵入式整合dwr和ext</h1>
  46.         <a href="index.jsp">返回</a>
  47.         <hr>
  48.         <div id="grid" style="height:300px;"></div>
  49.     </body>
  50. </html>