我希望在我的列表中显示从JSP页面检索到的数据。我不知道怎么做这个.Here是我的JSP页面。请同时更正JSP页。
**category_List.jsp**
%@page import="java.sql.*, java.util.*" %>
<%
response.setContentType("application/json");
String result = "{\"root\"[{\"category_name\": \"Model number\"}]}";
response.getWriter().print(result);
response.getWriter().flush();
%>
我的sencha代码
Ext.define('Sample.view.Blog',{
extend:'Ext.navigation.View',
xtype:'bloglist',
config:{
title:'Blog',
iconCls:'star',
scrollable:true,
styleHtmlContent: true,
items:{
xtype: 'list',
itemTpl: '{category_name}',
store:{
autoLoad: true,
fields: ['category_name'],
proxy:{
type: 'jsonp',
url: 'http://192.168.0.8:8080/new/category_list.jsp',
reader:{
type: 'json',
rootProperty: 'root'
}
}
}
}
}
});
我无法在列表中显示类别名称。有谁能帮帮我。谢谢
发布于 2012-04-11 06:33:22
尝试以下方法,看看是否有帮助。
String result
行的root
节点后缺少:。将该行更改为字符串结果=“{\”根:\“{\”category_name\“:\”型号\“}}”;
目前,您的JSP文件没有提供正确的JSON文档,这就是为什么在列表中看不到结果的原因。
[
开头,而是以]
结尾,则应将其添加到上一行的开头和结尾。
代理:{类型:'ajax',url:'http://192.168.0.8:8080/new/category_list.jsp',阅读器:{ type:'json',rootProperty:'root‘} }
https://stackoverflow.com/questions/10062022
复制相似问题