2012-04-11 111 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

相關問題