1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
    kumar k is on a distinguished road

      0  

    Default Unanswered: retrieving data from DB using jsp and want display that data list on sencha2 screen

    Unanswered: retrieving data from DB using jsp and want display that data list on sencha2 screen


    This is my jsp filein this i am displaying model_number list

    (modelnumber_list.jsp)

    Code:
    <%@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();
        
            while(result.next())
            {
                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)
        { 
            
        }
    %>
    the JS file is blog.js .In this i want display that model_number list on sencha touch 2 screen

    Code:
    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'
                               }
                           }
                       }   
                   }
               }
               });
    please suggest me how to get the list. In advance Thanks......
    Last edited by mitchellsimoens; 11 Apr 2012 at 5:20 AM. Reason: added [CODE] tags

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,118
    Answers
    3504
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What is a sample of your JSON look like?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
    kumar k is on a distinguished road

      0  

    Default


    Sample is a class name and view is the folder name in Sample and blog is the name of the js file. And I added
    requires: ['Ext.data.proxy.JsonP'], after xtype:'bloglist',. even not working please direct me to get solution....

    thanks( ' . ' )

Thread Participants: 1

Tags for this Thread