我使用JSP从数据库中检索数据,我想在使用senchatouch2时显示该数据列表?

时间:2012-04-11 13:50:25

标签: sencha-touch-2

我有以下jsp页面。它正在显示结果。

enter code here


<%@page language="java" import="java.sql.*, java.util.*, java.lang.*, net.sf.json.*,       org.json.simple.JSONObject" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"  %>



<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/thermo?user=root&password=");
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery("select model_number from product");

JSONObject json      = new JSONObject();
JSONArray  addresses = new JSONArray();
//JSONObject address =new JSONObject();
    while(result.next())
    {
        //address.put(result.getString("model_number"));
        addresses.add(result.getString("model_number"));
    }
    json.put("Addresses", addresses);
    out.println(addresses);

response.setContentType("application/json");
response.getWriter().write(json.toString());
}
    catch (JSONException jse)
{ 

}
%>



 and i have following js file.

  I got the following Exception when i run the js file.
[WARN][Anonymous] [Ext.Loader] Synchronously loading 'Ext.dataview.List'; consider     adding 'Ext.dataview.List' explicitly as a require of the corresponding class

:8080 /样品/ SDK / SRC /日志/写入器/ Console.js _dc = 1334137320671:35

[WARN] [匿名] [Ext.Loader]同步加载'Ext.data.proxy.JsonP';考虑明确添加“Ext.data.proxy.JsonP”作为相应类

的要求

Uncaught SyntaxError:意外的令牌:: 8080 / new / modelnumber_list.jsp?_dc = 1334137328213&amp; page = 1&amp; start = 0&amp; limit = 25&amp; callback = Ext.data.JsonP.callback1:1

enter code here

 `Ext.define('Sample.view.Blog',{
       extend:'Ext.navigation.View',
       xtype:'bloglist',
       config:{
           title:'Blog',
           iconCls:'star',
           scrollable:true,
           styleHtmlContent: true,
           items:{
               xtype: 'list',
               itemTpl: '{model_number}',
               store:{
                   autoLoad: true,
                   fields: ['model_number'],
                   proxy:{
                       type: 'jsonp',
                       url: 'modelnumber_list.jsp',
                       reader:{
                           type: 'json',
                            rootProperty: 'root'
                       }
                   }
               }   
           }
       }
       });





Thank you.

2 个答案:

答案 0 :(得分:1)

尝试在app.js上添加此项而非视图,这将删除警告。

requires: ['Ext.data.Store', 'Ext.data.proxy.JsonP', 'Ext.dataview.List'],

答案 1 :(得分:0)

尝试在xtype:'bloglist',之后添加以下行。我认为这会照顾你得到的警告。

requires: ['Ext.data.proxy.JsonP'],