EXT-JS java and Mysql

  1. sachintaware
    sachintaware
    I get the right json format for the database records using Java .
    Its like this.
    Code:
    {"device":[{"id":1,"uname":"Sachin","fname":"Sachin","lname":"Taware","emailid":"sachi@gmail.com","statename":"MH","cityname":"Pune","countryname":"India"},{"id":2,"uname":"Rahul","fname":"Rahul","lname":"Dravid","emailid":"rdravid@gmail.com","statename":"KA","cityname":"Bangalore","countryname":"India"},{"id":3,"uname":"MS","fname":"MS","lname":"Dhoni","emailid":"ms@gmail.com","statename":"JH","cityname":"Ranchi","countryname":"India"},{"id":4,"uname":"viru","fname":"Virender","lname":"Sehwag","emailid":"viru123@gmail.com","statename":"DL","cityname":"Delhi","countryname":"India"}]
    I have my script in an Html file.
    But,now how can I pass it to the store?
    The problem I think is in the proxy and reader section(I have highlighted it).Can I pass the URL of the class file of the compiled servlet ??If not how to pass the json to the store?
    Firebug shows me the same error of invalid json.I went though the PHP examples and there we give the .php
    file as URL.

    Code:
     <script type="text/javascript">
        
        Ext.onReady(function() {               
           Ext.define('Company', {
               extend: 'Ext.data.Model',
               fields: [
                        {name:'uname',type: 'string'},
                        {name:'fname',type: 'string'},
                        {name:'lname',type: 'string'},
                        {name:'emailid',type: 'string'},
                        {name:'statename',type: 'string'},
                        {name:'cityname',type: 'string'},
                        {name:'country',type: 'string'}]
           });
    
           var store_company = new Ext.data.Store({
              model: 'Company',
              proxy: {
                  type: 'ajax',
                  url: 'register.class',
                  
                  reader: {
                      type: 'json',
                      root:'device'
                  },
                  
              }
              
           });                             
            
            
            var grid_company = Ext.create('Ext.grid.Panel', {
                                          
                store: store_company,
                    
                    columns:[
                         
                    {
                        text     : 'User Name',
                        width    : 120,
                        sortable : true,
                        
                        dataIndex: 'uname'
                    },
                    {
                        text     : 'Firstname',
                        width    : 120,
                        sortable : true,
                        dataIndex: 'fname'
                    },
                    {
                        text     : 'Lastname',
                        width    : 110, 
                        sortable : true,
                        dataIndex: 'lname'
                    },
                    {
                        text     : 'Email',
                        width    : 150, 
                        sortable : true,
                        dataIndex: 'emailid'
                    },
                    {
                        text     : 'State',
                        width    : 100, 
                        sortable : true,
                        dataIndex: 'statename'
                    },
                    {
                        text     : 'City',
                        width    : 150, 
                        sortable : true,
                        dataIndex: 'cityname'
                    },
                    {
                        text     : 'Country',
                        width    : 150, 
                        sortable : true,
                        dataIndex: 'countryname'
                    }
                ],
                 bbar: Ext.create('Ext.PagingToolbar', {
            store: store_company,
            displayInfo: true,
            displayMsg: 'Displaying topics {0} - {1} of {2}',
            emptyMsg: "No topics to display"
        }),    
                height: 210,
                width: 902,
                title: 'Company List',
                renderTo: 'grid-company',
                viewConfig: {
                            stripeRows: true
                    }        
            });
            store_company.load();
        });
        </script>

    Regards
    Sachin
  2. Reimius
    Reimius
    With servlets, there is no file extension. Your url will be 'register'
  3. sachintaware
    sachintaware
    @Reimius

    Thank you very much for the reply,but I had solved the issue earlier and did not close the thread.

    Now I have started working with Extjs-Spring-Hibernate as many suggested servlets are not the right way to go.
    Can you help me with some specific examples related to Extjs JSON and spring -hibernate configuration.
    I am struggling a bit to achieve that and there is not much help apart from Loaine's example on it.I have to build a email-SMS application for my company using these technologies and your help or any relevant pointers would be a value addition.

    Regards
    Sachin
  4. Reimius
    Reimius
    I would recommend against using Servlets unless actually necessary also. We try to use JSP pages for everything, unless a servlet or custom JSP tag is absolutely necessary. I'm sorry, I do not use the spring -hibernate configuration, but for JSON I highly recommend the net.sf.json library for JSON. The only issue with that library is that it's handling of null values (since they are not actually equivelant to Java's handling of the null keyword) according to industry standards is not actually very useful in realistic environments.
Results 1 to 4 of 4

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar