2012-04-11 107 views
0

我有以下jsp page.and它正在显示结果。我使用JSP从数据库中检索数据,我想在使用senchatouch2时显示那个数据列表?

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' 明确为需要相应的类

未捕获的SyntaxError的:意外标记:: 8080 /新/ modelnumber_list.jsp _dc = 1334137328213 &页面= 1点&开始= 0 &限制= 25 &回调= 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. 

回答

0

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

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

[WARN] [匿名] [Ext.Loader]同步加载'Ext.dataview.List'; 考虑明确添加“Ext.dataview.List”作为相应类的要求 未捕获的错误:[Ext.createByAlias]无法创建无法识别的别名的实例:proxy.json sencha-touch.js:6366 – sirisha 2012-04-12 06:01:16

+0

当我使用在我的程序中的上述代码我得到了上述错误。 – sirisha 2012-04-12 06:02:17

1

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

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

标记为答案 – DWolf 2012-11-19 15:57:19

相关问题