extjs 分页使用jsp传递数据示例_extjs

WBOY
Release: 2016-05-16 16:40:49
Original
1060 people have browsed it
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 ] }); });
Copy after login

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); }
Copy after login

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

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

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

<?xml version="1.0" encoding="UTF-8"?>   test com.aa.TestAction   test *.do   index.jsp  
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!