Extjs 笔记 增加gridpanel的click监听事件

js 文件:


Ext.BLANK_IMAGE_URL = basePath + 'ext/resources/images/default/s.gif';
Ext.SSL_SECURE_URL = basePath + 'ext/resources/images/default/s.gif';
var baseUrl = basePath + 'AjaxListener?className=com.dvision.digitalplatform.bizApp.tisInfo.ttsInfo';
var tree_unit = '';
var tree_unit_id = '0';


Ext.onReady(function(){

    
    Ext.QuickTips.init();
//--------------------------------------------------------------------------------------------------------------------------------------------    
    var reader = new Ext.data.JsonReader({
                    id : 'ID',
                     root : 'root',
                    totalProperty : 'totalProperty',
                    fields : ['TSIP','TSINNUM','TSPORT','TSOUTNUM','TSID']
                });
 


    var openUrl = baseUrl;
        openUrl += '&methodName=getTTS';
        openUrl += '&paramCount=2';

                
     roleStore = new Ext.data.Store({
              proxy : new Ext.data.HttpProxy({
                       url : openUrl
            }),
             reader : reader
    });
     
   roleStore.load({
        params : {
                param_0 : 0,
                param_1 : 19
         }
    });
   var bbar = new Ext.PagingToolbar({
            id:'bb',
            pageSize : 19,
            store:roleStore,
            storeParams : {
                           className : 'com.dvision.digitalplatform.bizApp.ttsInfo',
                           methodName : 'getTTS',
                           paramCount : '2',
                           param_0 : '0',
                           param_1 : '19'                            
                           },
              paramNames : {
                           start : 'param_0',
                           limit : 'param_1'
                            },
            displayInfo : true,
            displayMsg : "显示 {0} - {1},共 {2}条",
            emptyMsg : '没有数据需要分页',
            stripeRows : true,
            items : ['-']
     });

var sm1 = new Ext.grid.CheckboxSelectionModel({
    singleSelect : false
});





var grid = new Ext.grid.GridPanel({
                id :'grid',
                width: Ext.get('tabs1').getWidth(),
                ds : roleStore,
                cm : new Ext.grid.ColumnModel([
                            sm1,
                            {    
                                width : 140,
                                header : '转发ID',
                                align : 'left',
                                dataIndex : 'TSID',
                                sortable:true
                            },
                            {
                                width : 140,
                                header : '转发IP',
                                align : 'left',
                                dataIndex : 'TSIP'
                            },
                            {
                                width : 140,
                                header : '转发端口',
                                align : 'left',
                                dataIndex : 'TSPORT'
                            }
                            ,
                            {
                                id : 'tsinnum',
                                width : 140,
                                header : '传入码流数量',
                                align : 'left',
                                dataIndex : 'TSINNUM'
                            }
                            ,
                            {
                                width : 140,
                                header : '传出码流数量',
                                align : 'left',
                                dataIndex : 'TSOUTNUM'
                            }        
                    ]),
                    sm:sm1,
                width : 1345,
                height :430,
                frame: false,
                fill : true,
                bbar :bbar
});
  setInterval(function(){
   roleStore.reload();  // dataStore 换成你的 store 的变量名
}, 2000);  //每隔 1 秒  

grid.addListener('cellclick', cellclick);
function cellclick(grid, rowIndex, columnIndex, e) {
   // var record = grid.getStore().getAt(rowIndex);   //Get the Record
   // var fieldName = grid.getColumnModel().getDataIndex(columnIndex); //Get field name
    //var data = record.get(fieldName);
    //  Ext.MessageBox.alert('show');
     // Ext.MessageBox.alert('wo xxxxx',columnIndex);
    sel = grid.getSelectionModel().getSelections();
    var a =sel[0].data.TSID;
   // Ext.MessageBox.alert(sel[0].data.TSID);
    
    if(columnIndex==5){
    
        var reader4 = new Ext.data.JsonReader({
                    id : 'ID',
                     root : 'root',
                    totalProperty : 'totalProperty',
                    fields : ['DEVICENAME','TSOUTID','USERIP','USERPORT','TSID','USERID','CHANNELNAME']
                });
 


    var openUrl4 = baseUrl;
        openUrl4 += '&methodName=getTISOUT';
        openUrl4 += '&paramCount=3';
//      openUrl += '&param_0=0';
//      openUrl += '&param_1=10';
                
     roleStore4 = new Ext.data.Store({
              proxy : new Ext.data.HttpProxy({
                       url : openUrl4
            }),
             reader : reader4
    });
     
    roleStore4.baseParams['param_2']=a;
            roleStore4.removeAll();
            //Ext.getCmp('cx').setDisabled(true);
            roleStore4.reload({
                             params:{
                                        className : 'com.dvision.digitalplatform.bizApp.ttsInfor',
                                        methodName : 'getTISOUT',
                                        paramCount : '3',
                                        param_0 : 0,
                                        param_1 : 15,
                                        param_2 : a
                                    }
                     });
            grid.getView().refresh();
            
            
   var bbar4 = new Ext.PagingToolbar({
            id:'bb',
            pageSize : 19,
            store:roleStore4,
            storeParams : {
                           className : 'com.dvision.digitalplatform.bizApp.ttsInfo',
                           methodName : 'getTISOUT',
                           paramCount : '3',
                           param_0 : '0',
                           param_1 : '19',
                           param_2 : a
                           },
              paramNames : {
                           start : 'param_0',
                           limit : 'param_1',
                           str   :  a
                            },
            displayInfo : true,
            displayMsg : "显示 {0} - {1},共 {2}条",
            emptyMsg : '没有数据需要分页',
            stripeRows : true,
            items : ['-']
     });

var sm4 = new Ext.grid.CheckboxSelectionModel({
    singleSelect : false
});
    
   
    win=new Ext.Window({
       id : 'popWin',
       layout : 'fit',
       title  : '转发传出信息',
       anchor : '50%',
       width : 760,
       height : 400,
       closeAction : 'close',
       plain : true,
       modal : true,
       items : [
      new Ext.grid.GridPanel({
                id :'grid4',
                width: Ext.get('tabs1').getWidth(),   
                ds : roleStore4,
                cm : new Ext.grid.ColumnModel([
                            sm4,
                            {   
                                width : 120,
                                header : '转发传出信息ID',
                                align : 'left',
                                dataIndex : 'TSOUTID',
                                sortable:true
                            },
                            {
                                width : 70,
                                header : '转发ID',
                                align : 'left',
                                dataIndex : 'TSID'
                            },
                            {
                                width : 70,
                                header : '用户ID',
                                align : 'left',
                                dataIndex : 'USERID'
                            },
                            {
                                width : 120,
                                header : '用户IP',
                                align : 'left',
                                dataIndex : 'USERIP'
                            }
                            ,
                            {
                                width : 100,
                                header : '用户端口',
                                align : 'left',
                                dataIndex : 'USERPORT'
                            }
                            ,
                            {
                                width : 110,
                                header : '设备名称',
                                align : 'left',
                                dataIndex : 'DEVICENAME'
                            },
                            {
                                width : 110,
                                header : '通道名称',
                                align : 'left',
                                dataIndex : 'CHANNELNAME'
                            }       
                    ]),
                    sm:sm4,
                width : 1345,
                height :430,
                frame: false,
                fill : true,
                bbar :bbar4,
                tbar : [ {
                    text : '关闭',
                    handler : function() {
                    
                        win.close();
                         }
                       }]
        })

   ]
             
})

         win.show();
         setInterval(function() {
           roleStore4.reload();  // dataStore 换成你的 store 的变量名
        }, 2000);  //每隔 1 秒  


}



if(columnIndex==4){
              var reader3 = new Ext.data.JsonReader({
                    id : 'ID',
                     root : 'root',
                    totalProperty : 'totalProperty',
                    fields : ['TSINID','ISID','DEVICENAME','TSID','CHANNELNAME']
                });
 


    var openUrl3 = baseUrl;
        openUrl3 += '&methodName=getTTSIN';
        openUrl3 += '&paramCount=3';
//      openUrl += '&param_0=0';
//      openUrl += '&param_1=10';
                
     roleStore3 = new Ext.data.Store({
              proxy : new Ext.data.HttpProxy({
                       url : openUrl3
            }),
             reader : reader3
    });
     
    roleStore3.baseParams['param_2']=a;
            roleStore3.removeAll();
            //Ext.getCmp('cx').setDisabled(true);
            roleStore3.reload({
                             params:{
                                        className : 'com.dvision.digitalplatform.bizApp.ttsInfor',
                                        methodName : 'getTTSIN',
                                        paramCount : '3',
                                        param_0 : 0,
                                        param_1 : 15,
                                        param_2 : a
                                    }
                     });
            grid.getView().refresh();
   var bbar3 = new Ext.PagingToolbar({
            id:'bb',
            pageSize : 15,
            store:roleStore3,
            storeParams : {
                           className : 'com.dvision.digitalplatform.bizApp.ttsInfo',
                           methodName : 'getTTSIN',
                           paramCount : '3',
                           param_0 : '0',
                           param_1 : '15',
                           param_2 :  a
                           },
              paramNames : {
                           start : 'param_0',
                           limit : 'param_1',
                           str   : a
                            },
            displayInfo : true,
            displayMsg : "显示 {0} - {1},共 {2}条",
            emptyMsg : '没有数据需要分页',
            stripeRows : true,
            items : ['-']
     });

var sm3 = new Ext.grid.CheckboxSelectionModel({
    singleSelect : false
});
    
   
    win=new Ext.Window({
       id : 'popWin',
       layout : 'fit',
       title  : '转发传入信息',
       anchor : '50%',
       width : 700,
       height : 400,
       closeAction : 'close',
       plain : true,
       modal : true,
       items : [
      new Ext.grid.GridPanel({
                id :'grid3',
                width: Ext.get('tabs1').getWidth(),
                ds : roleStore3,
                cm : new Ext.grid.ColumnModel([
                            sm3,
                            {   
                                width : 130,
                                header : '转发传入信息ID',
                                align : 'left',
                                dataIndex : 'TSINID',
                                sortable:true
                            },
                            {
                                width : 130,
                                header : '转发ID',
                                align : 'left',
                                dataIndex : 'TSID'
                            },
                            {
                                width : 130,
                                header : '接口ID',
                                align : 'left',
                                dataIndex : 'ISID'
                            }
                            ,
                            {
                                width : 130,
                                header : '设备名称',
                                align : 'left',
                                dataIndex : 'DEVICENAME'
                            }
                            ,
                            {
                                width : 130,
                                header : '通道名称',
                                align : 'left',
                                dataIndex : 'CHANNELNAME'
                            }       
                    ]),
                    sm:sm3,
                width : 1345,
                height :430,
                frame: false,
                fill : true,
                bbar :bbar3,
                tbar : [ {
                    text : '关闭',
                    handler : function() {
                    
                        win.close();
                         }
                       }]
        })

       ]
             
    });
                 win.show();  
                 setInterval(function() {
                   roleStore3.reload();  // dataStore 换成你的 store 的变量名
                }, 2000);  //每隔 1 秒  

  }
};

//-----------------------------------------------------------------------------------------------------------------------------------------------    
        var reader2 = new Ext.data.JsonReader({
                    id : 'ID',
                     root : 'root',
                    totalProperty : 'totalProperty',
                    fields : ['ISIP','ISCHLNUM','ISDEVNUM','ISOUTNUM','ISPORT','ISID']
                });
 


    var openUrl2 = baseUrl;
        openUrl2 += '&methodName=getTIS';
        openUrl2 += '&paramCount=2';
//        openUrl += '&param_0=0';
//        openUrl += '&param_1=10';
                
     roleStore2 = new Ext.data.Store({
              proxy : new Ext.data.HttpProxy({
                       url : openUrl2
            }),
             reader : reader2
    });
     
   roleStore2.load({
        params : {
                param_0 : 0,
                param_1 : 19
         }
    });
   var bbar2 = new Ext.PagingToolbar({
            id:'bb',
            pageSize : 19,
            store:roleStore2,
            storeParams : {
                           className : 'com.dvision.digitalplatform.bizApp.ttsInfo',
                           methodName : 'getTIS',
                           paramCount : '2',
                           param_0 : '0',
                           param_1 : '19'                            
                           },
              paramNames : {
                           start : 'param_0',
                           limit : 'param_1'
                            },
            displayInfo : true,
            displayMsg : "显示 {0} - {1},共 {2}条",
            emptyMsg : '没有数据需要分页',
            stripeRows : true,
            items : ['-']
     });


var sm2 = new Ext.grid.CheckboxSelectionModel({
    singleSelect : false
});

var grid2 = new Ext.grid.GridPanel({
                id :'grid2',
                width: Ext.get('tabs1').getWidth(),
                ds : roleStore2,
                cm : new Ext.grid.ColumnModel([
                            sm2,
                            {    
                                width : 100,
                                header : '接口ID',
                                align : 'left',
                                dataIndex : 'ISID',
                                sortable:true
                            },
                            {
                                width : 130,
                                header : '接口IP',
                                align : 'left',
                                dataIndex : 'ISIP'
                            },
                            {
                                width : 130,
                                header : '接口端口',
                                align : 'left',
                                dataIndex : 'ISPORT'
                            },
                            {
                                width : 130,
                                header : '接入设备数量',
                                align : 'left',
                                dataIndex : 'ISDEVNUM'
                            }
                            ,
                            {
                                width : 130,
                                header : '接入通道数量',
                                align : 'left',
                                dataIndex : 'ISCHLNUM'
                            }
                            ,
                            {
                                width : 130,
                                header : '传出码流数量',
                                align : 'left',
                                dataIndex : 'ISOUTNUM'
                            }        
                    ]),
                    sm:sm2,
                width : 1345,
                height :430,
                frame: false,
                fill : true,
                bbar :bbar2
});
  setInterval(function() {
   roleStore2.reload();  // dataStore 换成你的 store 的变量名
}, 2000);  //每隔 1 秒  


//-----------------------------------------------------------------------------------------------------------------------------------------------

     var tabs = new Ext.TabPanel({
        //renderTo: 'tabs1',
        contentEl:'tabs1',
        width:1350,
        height: 500,
        activeTab: 0,
        frame:true,
        defaults:{autoHeight: true},
        deferredRender :false
        
    });
       tabs.add({
       id:"grid",
       title:'转发信息',  
       layout:'border',
        items:[grid]
        });  
        tabs.add({  
        id:'grid2',
        title:'接口信息',  
        layout:'border',
        items:[grid2]
        });
        tabs.activate(0);    
        var viewport = new Ext.Viewport({
            region:'center',  
            layout:'fit',  
            split:true,  
            collapsible: true,  
            margins:'0 0 0 0',  
            frame:true,  
            items:tabs  
    });

});  


ajaxlistener的servletjava类:


package com.dvision.digitalplatform.ajaxUtil;

import java.io.*;
import java.lang.reflect.Method;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

// Referenced classes of package com.jarp.core:
//            Env, Repository

public class AjaxListener extends HttpServlet
{

    public static Logger logger;
    String className;
    String methodName;
    ArrayList paramList;
    int intParamCount;
    static Class class$0; /* synthetic field */

//    public void init() throws ServletException
//    {
//        String repository_DBName = "";
//        String repository_DBPoolType = "";
//        String repository_DBJNDIName = "";
//        String repository_JdbcDriver = "";
//        String repository_JdbcURL = "";
//        String repository_UserName = "";
//        String repository_Password = "";
//        int repository_maxConnection = 3;
//        BasicConfigurator.configure();
//        try
//        {
//            logger.info("======== AjaxListener initial started (TESTING...) ========");
//            repository_DBName = getInitParameter("repository_DBName");
//            repository_DBPoolType = getInitParameter("repository_DBPoolType");
//            repository_DBJNDIName = getInitParameter("repository_DBJNDIName");
//            if(repository_DBName == null)
//                repository_DBName = "AjaxListener";
//            if(repository_DBName.equals(""))
//                repository_DBName = "AjaxListener";
//            logger.info("======== repository_DBName == " + repository_DBName + " ========");
//            logger.info("======== repository_DBPoolType == " + repository_DBPoolType + " ========");
//            if(repository_DBPoolType.equals("Pool"))
//            {
//                repository_JdbcDriver = getInitParameter("repository_JdbcDriver");
//                repository_JdbcURL = getInitParameter("repository_JdbcURL");
//                repository_UserName = getInitParameter("repository_UserName");
//                repository_Password = getInitParameter("repository_Password");
//                repository_maxConnection = (new Integer(getInitParameter("repository_maxConnection"))).intValue();
//                ConnectionPools pools = ConnectionPools.getInstance();
//                int idx = pools.setPoolParams(repository_DBName, repository_JdbcDriver, repository_JdbcURL, repository_UserName, repository_Password, repository_maxConnection, -1);
//                if(pools.createPool(idx))
//                {
//                    logger.info("-------- Repository connection pool created --------");
//                }
//                logger.info("======== AjaxListener initial finished ========");
//            }
//            if(repository_DBPoolType.equals("systemPool") && repository_DBJNDIName != null)
//            {
//                ConnectionPools pools = ConnectionPools.getInstance();
//                repository_maxConnection = (new Integer(getInitParameter("repository_maxConnection"))).intValue();
//                int idx = pools.setPoolParams(repository_DBName, repository_DBJNDIName, repository_maxConnection, -1);
//                if(pools.createPool(idx))
//                {
//                    logger.info("-------- Repository connection pool created --------");
//                }
//                logger.info("======== AjaxListener initial finished ========");
//            }
//        }
//        catch(Exception ex)
//        {
//            ex.printStackTrace();
//            logger.error("======== AjaxListener initial failed ========");
//        }
//    }

    public AjaxListener()
    {
        className = "";
        methodName = "";
        paramList = null;
        intParamCount = 0;
    }

    public void destroy()
    {
        super.destroy();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        response.setContentType("text/xml;charset=GBK");
        request.setCharacterEncoding("GBK");
        PrintWriter out = response.getWriter();
        String className = "";
        String methodName = "";
        ArrayList paramList = new ArrayList();
        int intParamCount = 0;
        className = request.getParameter("className");
        methodName = request.getParameter("methodName");
        String paramCount = request.getParameter("paramCount");
        if(paramCount == null)
            paramCount = "0";
        intParamCount = Integer.parseInt(paramCount);
        paramList = new ArrayList();
        for(int i = 0; i < intParamCount; i++)
        {
            String p = request.getParameter("param_" + i);
            paramList.add(p);
        }

        BufferedReader bufReader = request.getReader();
        String strLine = "";
        StringBuffer xml = new StringBuffer();
        while((strLine = bufReader.readLine()) != null)
            xml.append(strLine);
        String xmlReturn = doAction(className, methodName, intParamCount, paramList, xml);
        out.print(xmlReturn);
        out.flush();
        out.close();
        paramList = null;
        xml = null;
    }

    private String doAction(String className, String methodName, int intParamCount, ArrayList paramList, StringBuffer bufXML)
    {
        String xmlRet = "";
        try
        {
            Class actionClass = Class.forName(className);
            Object actionInstance = actionClass.newInstance();
            Object ret = new Object();
            int paramCount = intParamCount;
            if(bufXML.length() > 0)
                paramCount++;
            Class params[] = new Class[paramCount];
            Object paramValues[] = new Object[paramCount];
            for(int i = 0; i < paramCount; i++)
            {
                params[i] = Class.forName("java.lang.String");
                if(bufXML.length() > 0 && i == paramCount - 1)
                    paramValues[i] = bufXML.toString();
                else
                    paramValues[i] = (String)paramList.get(i);
            }

            Method m = actionClass.getMethod(methodName, params);
            ret = m.invoke(actionInstance, paramValues);
            xmlRet = ret.toString();
        }
        catch(Exception ex)
        {
            logger.error("className = " + className + "||" + "methodName = " + methodName);
            for(int i = 0; i < intParamCount; i++)
                logger.error("param_" + i + " = " + (String)paramList.get(i) + "||");

            logger.error("doAction's error: " + ex.toString());
            ex.printStackTrace();
        }
        return xmlRet;
    }

    static
    {
        logger = Logger.getLogger(com.dvision.digitalplatform.ajaxUtil.AjaxListener.class.getName());
    }
}

后台java文件:

package com.dvision.digitalplatform.bizApp.tisInfo;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.sql.DataSource;

import net.sf.json.JSONArray;

import com.dvision.digitalplatform.ajaxUtil.DAO;
import com.dvision.digitalplatform.utils.CollectionUtil;
import com.dvision.digitalplatform.utils.StringUtil;

public class ttsInfo{
    
    
    public String getTTS(String start, String limit) throws IOException{
        
        
        DAO dao = new DAO();
        Vector v = new Vector();
        Vector v2 = new Vector();
        HashMap fatherhm = new HashMap();
        String rtn = "";
        int p1=Integer.parseInt(start);
        int p2=p1+Integer.parseInt(limit);
        
        try {
            
            v = dao.execCommand("select count(1) as TSID from T_TSInfo");
            
        if (Integer.parseInt(((Hashtable) v.get(0)).get("TSID").toString()) <= p2)
        p2 = Integer.parseInt(((Hashtable) v.get(0)).get("TSID").toString());
            
            v=dao.execCommand("select * from T_TSInfo order by TSID desc");
            for(int i=p1;i<p2;i++){
                Hashtable ht=(Hashtable)v.get(i);
                v2.add(ht);
            }
            if(v!=null&&v2!=null){
            rtn = "{\"totalProperty\":\"" + v.size() + "\",\"root\":"
            + JSONArray.fromObject(v2).toString() + "}";
            }
        } catch (ServletException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //System.out.println(rtn);
        
        return rtn;
    }

public String getTTSIN(String start, String limit,String str) throws IOException{
    
    
    DAO dao = new DAO();
    Vector v = new Vector();
    Vector v2 = new Vector();
    HashMap fatherhm = new HashMap();
    String rtn = "";
    int p1=Integer.parseInt(start);
    int p2=p1+Integer.parseInt(limit);
    int p3=Integer.parseInt(str);
    try {
        
        v = dao.execCommand("select count(1) as TSInID from T_TSInInfo where TSID="+p3);
        
    if (Integer.parseInt(((Hashtable) v.get(0)).get("TSINID").toString()) <= p2)
    p2 = Integer.parseInt(((Hashtable) v.get(0)).get("TSINID").toString());
        
        v=dao.execCommand("select a.TSInID,a.TSID,a.ISID,b.DeviceName,c.ChannelName  from T_TSInInfo a left outer JOIN T_DeviceInfo b on a.DeviceID=b.DeviceID left outer JOIN T_ChannelInfo c on a.ChannelID=c.ChannelID where TSID="+p3+" order by TSInID desc");
        for(int i=p1;i<p2;i++){
            Hashtable ht=(Hashtable)v.get(i);
            v2.add(ht);
        }
        if(v!=null&&v2!=null){
        rtn = "{\"totalProperty\":\"" + v.size() + "\",\"root\":"
        + JSONArray.fromObject(v2).toString() + "}";
        }
    
    } catch (ServletException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }    
    return rtn;
}

public String getTIS(String start, String limit) throws IOException{
    
    
    DAO dao = new DAO();
    Vector v = new Vector();
    Vector v2 = new Vector();
    HashMap fatherhm = new HashMap();
    String rtn = "";
    int p1=Integer.parseInt(start);
    int p2=p1+Integer.parseInt(limit);
    
    try {
        
        v = dao.execCommand("select count(1) as ISID from T_ISInfo");
        if(v!=null)
    if (Integer.parseInt(((Hashtable) v.get(0)).get("ISID").toString()) <= p2)
    p2 = Integer.parseInt(((Hashtable) v.get(0)).get("ISID").toString());
        
        v=dao.execCommand("select * from T_ISInfo order by ISID desc");
        for(int i=p1;i<p2;i++){
            Hashtable ht=(Hashtable)v.get(i);
            v2.add(ht);
        }
        if(v!=null&&v2!=null){
        rtn = "{\"totalProperty\":\"" + v.size() + "\",\"root\":"
        + JSONArray.fromObject(v2).toString() + "}";
        }
    } catch (ServletException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    //System.out.println(rtn);

    return rtn;
}

public String getTISOUT(String start, String limit,String str) throws IOException{
    
    
    DAO dao = new DAO();
    Vector v = new Vector();
    Vector v2 = new Vector();
    HashMap fatherhm = new HashMap();
    String rtn = "";
    int p1=Integer.parseInt(start);
    int p2=p1+Integer.parseInt(limit);
    int p3=Integer.parseInt(str);
    //System.out.println(str);
    try {
        
        v = dao.execCommand("select count(1) as TSOutID from T_TSOutInfo where TSID="+p3);
    if (Integer.parseInt(((Hashtable) v.get(0)).get("TSOUTID").toString()) <= p2)
    p2 = Integer.parseInt(((Hashtable) v.get(0)).get("TSOUTID").toString());
        
        v=dao.execCommand("select a.TSOutID, a.TSID, a.UserID, a.UserIP, a.UserPort, b.DeviceName,c.ChannelName from T_TSOutInfo a left outer JOIN T_DeviceInfo b on a.DeviceID=b.DeviceID left outer JOIN T_ChannelInfo c on a.ChannelID=c.ChannelID where TSID="+p3+" order by TSOutID desc");
        for(int i=p1;i<p2;i++){
            Hashtable ht=(Hashtable)v.get(i);
            v2.add(ht);
        }
        if(v!=null&v2!=null){
        rtn = "{\"totalProperty\":\"" + v.size() + "\",\"root\":"
        + JSONArray.fromObject(v2).toString() + "}";
        }
    } catch (ServletException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return rtn;
}

}


jsp文件:


<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String roleID = "8";
String url = basePath + "AjaxListener?className=com.dvision.digitalplatform.treeFrame.TreeFrameManage";
            url += "&methodName=getTreeFrame";
            url += "&paramCount=1";
            url += "&param_0="+roleID;
            

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <script>
       var roleID = '<%=roleID%>'
    var basePath = '<%=basePath%>';

</script>
    <title>topFrameManage</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="<%=basePath %>ext/resources/css/ext-all.css"/>
    <script type="text/javascript" src="<%=basePath %>ext/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="<%=basePath %>ext/ext-all.js"></script>
    <script type="text/javascript" src="<%=basePath %>ext/source/locale/ext-lang-zh_CN.js"></script>
    
    <link rel="stylesheet" type="text/css" href="<%=basePath %>css/column-tree.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath %>css/columnLock.css"/>
    <script type="text/javascript" src="<%=basePath %>js/XMLHttpRequest.js"></script>
    <script type="text/javascript" src="<%=basePath %>js/TreeCheckNodeUI.js"></script>
    <script type="text/javascript" src="<%=basePath %>js/comm2.js"></script>
    <script type="text/javascript" src="<%=basePath %>bizApp/tisInfo/tsInfo.js"></script>
 
  </head>
 
  <body>
<div id="tabs1"></div>
  </body>
</html>


已标记关键词 清除标记
相关推荐
<p> <span style="color:#4d4d4d;">当前课程中博客项目的实战源码是我在 GitHub上开源项目 My-Blog,目前已有 2000 多个 star:</span> </p> <p> <span style="color:#4d4d4d;"><img src="https://img-bss.csdnimg.cn/202103310649344285.png" alt="" /><br /> </span> </p> <p> <span style="color:#4d4d4d;">本课程是一个 Spring Boot 技术栈的实战类课程,课程共分为 3 大部分,前面两个部分为基础环境准备和相关概念介绍,第三个部分是 Spring Boot 个人博客项目功能的讲解,<span style="color:#565656;">通过本课程的学习,不仅仅让你掌握基本的 Spring Boot 开发能力以及 Spring Boot 项目的大部分开发使用场景,同时帮你提前甄别和处理掉将要遇到的技术难点,认真学完这个课程后,你将会对 Spring Boot 有更加深入而全面的了解,同时你也会得到一个大家都在使用的博客系统源码,你可以根据自己的需求和想法进行改造,也可以直接使用它来作为自己的个人网站,这个课程一定会给你带来巨大的收获。</span></span> </p> <p> <span style="color:#4d4d4d;"><span style="color:#565656;"> </span></span> </p> <p> <span style="color:#e53333;"><span style="color:#e53333;"><strong>课程特色</strong></span></span> </p> <p> <span style="color:#e53333;"><span style="color:#e53333;"><strong> </strong></span></span> </p> <p> <span style="color:#4d4d4d;"><span style="color:#565656;"> </span></span> </p> <ol> <li> <span style="color:#565656;">课程内容紧贴 Spring Boot 技术栈,涵盖大部分 Spring Boot 使用场景。</span> </li> <li> <span style="color:#565656;">开发教程详细完整、文档资源齐全、实验过程循序渐进简单明了。</span> </li> <li> <span style="color:#565656;">实践项目页面美观且实用,交互效果完美。</span> </li> <li> <span style="color:#565656;">包含从零搭建项目、以及完整的后台管理系统和博客展示系统两个系统的功能开发流程。</span> </li> <li> <span style="color:#565656;">技术栈新颖且知识点丰富,学习后可以提升大家对于知识的理解和掌握,对于提升你的市场竞争力有一定的帮助。</span> </li> </ol> <p> <strong>实战项目预览</strong> </p> <p> <span style="color:#4d4d4d;"><span style="color:#565656;"><span style="color:#e53333;"><strong> </strong></span></span></span> </p> <p> <span style="color:#4d4d4d;"><img src="https://img-bss.csdn.net/202005150303066258.png" alt="" /><br /> </span> </p> <p>   </p> <p> <span style="color:#4d4d4d;"> </span> </p> <p> <span style="color:#4d4d4d;"><img src="https://img-bss.csdn.net/202005150305396930.png" alt="" /><br /> </span> </p> <p> <span style="color:#4d4d4d;"> </span> </p> <p> <span style="color:#4d4d4d;"><img src="https://img-bss.csdn.net/202005150305528842.png" alt="" /><br /> </span> </p> <p> <span style="color:#4d4d4d;"> </span> </p> <p> <span style="color:#4d4d4d;"><img src="https://img-bss.csdn.net/202005150306056323.png" alt="" /><br /> </span> </p>
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页