国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

extjs 分頁使用jsp傳遞數據示例

2019-11-20 14:19:03
字體:
來源:轉載
供稿:網友
Ext.onReady(function() {store3 = new Ext.data.JsonStore({autoDestroy: true,totalProperty : 'totle',url: 'service.do',storeId: 'myStore',root: 'data',fields : [ 'id', "name", "pw" ]});var pagingToolbar = new Ext.PagingToolbar({emptyMsg : "沒有數據",displayInfo : true,displayMsg : "顯示從{0}條數據到{1}條數據,共{2}條數據",store : store3,pageSize : 50});var grade = new Ext.grid.GridPanel({title : "數據列表",store : store3,height : 300,bbar : pagingToolbar,columns : [ {header : "id",dataIndex : "id",width : 300}, {header : "name",dataIndex : "name",width : 300}, {header : "pw",dataIndex : "pw"} ],region : 'center'});var panel = new Ext.Viewport({layout : 'border',items : [ grade ]});});

action********************

protected void service(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {List list = new ArrayList();for (int i = 0; i < 50; i++) {Person p = new Person();p.setId("id" + i);p.setName("name" + i);p.setPw("pw" + i);list.add(p);}StringBuffer info = new StringBuffer();info.append("{totle:2000,data:");info.append(JSONArray.fromObject(list));info.append("}");System.out.println(info.toString());System.out.println("*****doPos");request.setAttribute("info", info.toString());request.getRequestDispatcher("/info.jsp").forward(request, response);}

info.jsp************注意:jsp除了 @page 不能有其他的文字

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%>${info}

web.xml***************

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5"><servlet><servlet-name>test</servlet-name><servlet-class>com.aa.TestAction</servlet-class></servlet><servlet-mapping><servlet-name>test</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 叙永县| 阜宁县| 长兴县| 巨野县| 萨迦县| 乌兰县| 陆川县| 玉门市| 上杭县| 建始县| 酒泉市| 平果县| 望奎县| 阳曲县| 宁蒗| 申扎县| 常宁市| 胶州市| 娄烦县| 邹城市| 宁城县| 普宁市| 新和县| 莱西市| 鹤峰县| 永顺县| 兴仁县| 香港 | 伊春市| 抚松县| 铅山县| 桐梓县| 永和县| 乌拉特后旗| 隆回县| 彰化市| 田东县| 贵州省| 德江县| 永州市| 米脂县|