Extjs+Mysql動的ページングを実現


ちょうどExtjsを学んで、Extjsでページの小さい例を作って、何が間違っている地方があることを指摘して下さい
<title>    </title>
		<link rel="stylesheet" type="text/css" href="Extjs/resources/css/ext-all.css">
		<script type="text/javascript" src="Extjs/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="Extjs/ext-all.js"></script> 
        <script type="text/javascript">
        	Ext.onReady(function(){
        		var userStore = new Ext.data.Store({
        			
        			proxy : new Ext.data.HttpProxy( {  
            				url : 'groups.do?method=groupsQuery'//        url  
        			}),  
        			reader : new Ext.data.JsonReader({
        				totalProperty : 'results',
        				root : 'items',
        				id : 'row_id'
        			},
        			['row_id','name','createid','createtime','updateid','updatetime'])
        		});
        		
        		
        		
        		var sm = new Ext.grid.CheckboxSelectionModel();
        		var cm = new Ext.grid.ColumnModel([
        			new Ext.grid.RowNumberer(),sm,{
        				header : '  ',
        				width : 30,
        				dataIndex : 'row_id',
        				sortable : true	
        			},{
        				header : '   ',
        				width : 40,
        				dataIndex : 'name',
        				sortable : true
        			},{
        				header : '    ',
        				width:50,
        				dataIndex : 'createtime',
        				sortable : true
        			},{
        				header : '    ',
        				width : 50,
        				dataIndex : 'updatetime',
        				sortable : true
        			}
        		]);
        		
        		
        		var userGrid = new Ext.grid.GridPanel({
        			applyTo : 'user-grid-div',//            
       			    frame : true,//          
                    //tbar : toolbar,//           
                    stripeRows : true,//         
                    autoScroll : true,//           ,        
                    store : userStore,//              
                    loadMask : true,
					autoHeight : true,
					autoWidth : true,
					viewConfig : {
						autoFill : true
					},
					cm : cm,
					sm : sm,
					
					bbar : new Ext.PagingToolbar({
						pageSize : 5,
						store : userStore,
						displayInfo : true,
						beforePageText:' ',
    					afterPageText:'   {0} ',
						displayMsg:'    {0}    {1}    ,   {2}  ',
						emptyMsg : '    ',
						firstText:'  ',
      					prevText:'   ',
     					nextText:'   ',
     					lastText:'  ',
     					refreshText:'  '
					})
					
        		});
        		userStore.reload({
        			params:{start:0,limit:5}
        		})
        	})
        </script>
  </head>
  <body>
    <div id = "user-grid-div" style="width:100%; height:100%;"></div>
  </body>
</html>
 
public List getGroupsQuery(Connection con,int start,int end) throws SQLException{
		List list = new ArrayList();
		Statement st = con.createStatement();
		//String sql = "select * from groups";
		String sql = "select * from groups limit "+start+","+end;
		ResultSet rs = st.executeQuery(sql);
		while(rs.next()){
			Groups groups = new Groups();
			groups.setRow_id(rs.getString("row_id"));
			groups.setName(rs.getString("name"));
			groups.setUpdateid(rs.getString("updateid"));
			groups.setUpdatetime(rs.getString("updatetime"));
			groups.setCreateid(rs.getString("createid"));
			groups.setCreatetime(rs.getString("createtime"));
			list.add(groups);
		}
		rs.close();
		st.close();
		return list;
		
	}
	
	public int getGroupsCount(Connection con) throws SQLException{
		Statement st = con.createStatement();
		String sql = "select count(1) from groups";
		ResultSet rs = st.executeQuery(sql);
		int totalCount = 0;
		while(rs.next()){
			 totalCount = rs.getInt(1);
		}
		rs.close();
		st.close();
		return totalCount;
	}
 
private groupsDaoImpl gDao = new groupsDaoImpl();
	
	public List getUserQuery(int start,int end){
		List list = null;
		Connection con = null; 
		try {
			con = DBCon.getConnection();
			//list = uDao.getUserQuery(con);
			list = gDao.getGroupsQuery(con, start, end);
		} catch (Exception e) {
			list = new ArrayList();
			e.printStackTrace();
		}finally{
			try {
				if(con!=null){con.close();}
			} catch (Exception e) {e.printStackTrace();}
		}
		return list;
 	}
	
	public int getGroupsCount(){
		int totalCount = 0;
		Connection con = null; 
		try {
			con = DBCon.getConnection();
			//list = uDao.getUserQuery(con);
			totalCount = gDao.getGroupsCount(con);
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			try {
				if(con!=null){con.close();}
			} catch (Exception e) {e.printStackTrace();}
		}
		return totalCount;
	}
 
private groupsBiz gBiz = new groupsBiz();
	
	public ActionForward groupsQuery(ActionMapping mapping, ActionForm form,
			  HttpServletRequest request, HttpServletResponse response)throws Exception{
		int start = Integer.parseInt(request.getParameter("start"));
		int end = Integer.parseInt(request.getParameter("limit"));
		System.out.println("start"+start);
		List groups = gBiz.getUserQuery(start,end);
		int totalCount = gBiz.getGroupsCount();
		/*
		int pager = Integer.valueOf(start);
		List groups = gBiz.getUserQuery();
		List list =new ArrayList();
		if(pager==0){
			if(groups.size()>5){
				for(int i=0;i<5;i++){
					list.add(groups.get(i));
				}
			}else{
				for(int i=0;i<groups.size();i++){
					list.add(groups.get(i));
				}
			}
		}else{
			int num = pager+5;
			if(groups.size()>num){
				for(int i=pager; i<num;i++){
					list.add(groups.get(i));  
				}
			}else{
				for(int i=pager; i<groups.size();i++){
					list.add(groups.get(i));
				}
			}
		}
		*/
		JSONObject jsonObject = ExtHelper.getJsonFromList(totalCount,groups);
		System.out.println("json  :"+jsonObject);
		response.setContentType("text/jsom;charset=UTF-8");
		response.getWriter().write(jsonObject.toString());
		return null;
	}