1. #1
    Ext User
    Join Date
    Aug 2010
    Location
    Gurgaon, India
    Posts
    18
    Vote Rating
    0
    sunder is on a distinguished road

      0  

    Default How i connect java code with Sencha Touch ! ! !

    How i connect java code with Sencha Touch ! ! !


    Hi ,
    I am new to use sencha touch,

    I have a website which is built in Java/J2EE and Struts framework. I am looking to build the mobile webapp using Sencha Touch. But i want to know if and how we can connect our back-end Java application with a Sencha Touch based front end.


    so please assist me and give me guideline for this.


    Regards...

    Sunder

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Yes, you can, but in most cases you will want to change the reponse of the server from a html page to JSON data (the simplest way to do this is to use json-taglib in your response .jsp).

  3. #3
    Ext User
    Join Date
    Aug 2010
    Location
    Gurgaon, India
    Posts
    18
    Vote Rating
    0
    sunder is on a distinguished road

      0  

    Default


    So,

    Please tell me how i will get started to write code with sencha touch.

    Thanks

    Sunder

  4. #4
    Ext User
    Join Date
    Aug 2010
    Location
    Gurgaon, India
    Posts
    18
    Vote Rating
    0
    sunder is on a distinguished road

      0  

    Default


    Hi,

    I am new to extjs. I want to make a web application based on EXTJS application with struts1.2.
    My problem is that:-

    I have a page (html) which have some textfield and create this with FormPanel. (register.js)
    Textfields are firstname, lastname, city, state, country.
    I have action class (RegisterAction.java)
    I got all textfied value and perform some business logic inside action class after getting those values I want to display those values on the page.

    So please anybody tell me the possible way how I can display those values on the page.

    I tried it on my end with the help of JSON.
    I am writing some code of my point of view which I had tried, please anybody tell me how much this code is fine. If I am wrong please give me suggestions how I can display these values on page.
    I got all textfied value in action class and I add these values in Arraylist and that Arraylist I convert into json object.
    1.RegisterAction.java
    List list=new Arraylist ();
    list.add(firstname);
    list.add(lastname);
    list.add(email);
    list.add(state);
    list.add(city);
    list.add(country);

    JSONArray jsonArray = JSONArray.fromObject (list);
    String showJsonObject=jsonArray.toString ();

    PrintWriter pw=response.getWriter ();
    pw.write (showJsonObject);

    Now I want display that json object on other page (showData.js).
    I read EXTJS API through this I understood that we can do it through Ext.data.Store and Ext.data.JsonReader.

    I tried it on my code but I am unable to display json objects on the page.

    2.ShowData.js
    Ext.onReady(function()
    {
    var myReader = new Ext.data.JsonReader(
    {root: 'showjsonObject'}, ['firstname','lastname','email','city','state','country']
    );

    var dataFromServer = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({url:'/register.do'}),
    reader: myReader
    });


    dataFromServer.on('load', function() {


    var grid = new Ext.grid.GridPanel({
    store: dataFromServer,
    columns: [
    {header: 'FirstName', width: 90, sortable: true, dataIndex: 'firstname'},
    {header: 'LastName', width: 90, sortable: true, dataIndex: 'lastname'},
    {header: 'Email', width: 90, sortable: true, dataIndex: 'email'},
    {header: 'City', width: 90, sortable: false, dataIndex: 'city'},
    {header: 'State', width: 90, sortable: false, dataIndex: 'state'},
    {header: 'Country', width: 90, sortable: false, dataIndex: 'country'}
    ]
    });
    });

    dataFromServer.load();
    });
    Can anybody tell me what code should be written inside show.js?
    What code should be needed to display json object on the page.

    Anybody please give me sample code and some guidance so that I can make application.

  5. #5
    Ext User
    Join Date
    Aug 2010
    Location
    Gurgaon, India
    Posts
    18
    Vote Rating
    0
    sunder is on a distinguished road

      0  

    Default


    Hi,

    I am new to extjs. I want to make a web application based on EXTJS application with struts1.2.
    My problem is that:-

    I have a page (html) which have some textfield and create this with FormPanel. (register.js)
    Textfields are firstname, lastname, city, state, country.
    I have action class (RegisterAction.java)
    I got all textfied value and perform some business logic inside action class after getting those values I want to display those values on the page.

    So please anybody tell me the possible way how I can display those values on the page.

    I tried it on my end with the help of JSON.
    I am writing some code of my point of view which I had tried, please anybody tell me how much this code is fine. If I am wrong please give me suggestions how I can display these values on page.
    I got all textfied value in action class and I add these values in Arraylist and that Arraylist I convert into json object.
    1.RegisterAction.java
    List list=new Arraylist ();
    list.add(firstname);
    list.add(lastname);
    list.add(email);
    list.add(state);
    list.add(city);
    list.add(country);

    JSONArray jsonArray = JSONArray.fromObject (list);
    String showJsonObject=jsonArray.toString ();

    PrintWriter pw=response.getWriter ();
    pw.write (showJsonObject);

    Now I want display that json object on other page (showData.js).
    I read EXTJS API through this I understood that we can do it through Ext.data.Store and Ext.data.JsonReader.

    I tried it on my code but I am unable to display json objects on the page.

    2.ShowData.js
    Ext.onReady(function()
    {
    var myReader = new Ext.data.JsonReader(
    {root: 'showjsonObject'}, ['firstname','lastname','email','city','state','country']
    );

    var dataFromServer = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({url:'/register.do'}),
    reader: myReader
    });


    dataFromServer.on('load', function() {


    var grid = new Ext.grid.GridPanel({
    store: dataFromServer,
    columns: [
    {header: 'FirstName', width: 90, sortable: true, dataIndex: 'firstname'},
    {header: 'LastName', width: 90, sortable: true, dataIndex: 'lastname'},
    {header: 'Email', width: 90, sortable: true, dataIndex: 'email'},
    {header: 'City', width: 90, sortable: false, dataIndex: 'city'},
    {header: 'State', width: 90, sortable: false, dataIndex: 'state'},
    {header: 'Country', width: 90, sortable: false, dataIndex: 'country'}
    ]
    });
    });

    dataFromServer.load();
    });
    Can anybody tell me what code should be written inside show.js?
    What code should be needed to display json object on the page.

    Anybody please give me sample code and some guidance so that I can make application

    Thanx in Advance......

  6. #6
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
    dlamotta is on a distinguished road

      0  

    Default Use GWT4Touch 2.0

    Use GWT4Touch 2.0


    Hey Sunder... try GWT4Touch. Both versions 1.1.1 and 2.0 (dev preview) are available today, and you'll be able to do your front-end in Java, and reuse your Java backed by tapping into GWT.

    Check out a live demo at gwt4touch2.appspot.com, or a video we posted on DZone (http://java.dzone.com/videos/intro-gwt4touch-20).

    You can get the package from www.emitrom.com/gwt4touch

    Best of luck!

  7. #7
    Sencha User
    Join Date
    Jan 2012
    Posts
    1
    Vote Rating
    0
    cilohaidem is on a distinguished road

      0  

    Default


    dlmotta - tnx! this is great news!

Similar Threads

  1. Sample code to submit a Sencha Touch form?
    By profunctional in forum Sencha Touch 1.x: Discussion
    Replies: 11
    Last Post: 12 Apr 2012, 9:11 PM
  2. Sencha Touch on iPhone v1 / iPod touch v1 ?
    By palnap in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 28 Oct 2010, 5:30 PM
  3. Suggestions for someone new to Sencha Touch
    By nemozob in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 11 Aug 2010, 10:37 AM
  4. Features of Sencha Touch
    By metalsiren in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 21 Jul 2010, 8:02 AM

Thread Participants: 3