Professional Web Applications Themes

Mapping Java ResultSet to Flex - Macromedia Flex General Discussion

I finally got java and flex working together as a team yesterday. After creating simple programs such as fetching string and calculating factorial, I went over to sql. I fetched some sql records and displayed them in a datagrid successfully. Unfortunately, I didnt save the results and I can't reaccomplish that again. Here's the code I used (as far as I know) I am not sure what did I change, as it worked before and populated the datagrid with the sql data. Now when I print result, all I see is lots of [object Object]. So the data is coming ...

  1. #1

    Default Mapping Java ResultSet to Flex

    I finally got java and flex working together as a team yesterday. After
    creating simple programs such as fetching string and calculating factorial, I
    went over to sql.

    I fetched some sql records and displayed them in a datagrid successfully.
    Unfortunately, I didnt save the results and I can't reaccomplish that again.
    Here's the code I used (as far as I know)

    I am not sure what did I change, as it worked before and populated the
    datagrid with the sql data. Now when I print result, all I see is lots of
    [object Object]. So the data is coming through, just not sure if its the right
    data, or how to map it to datagrid.

    Thanks



    [Java function to fetch sql records]

    public List getStudents() {
    List students = new ArrayList();
    try {
    String sql = "SELECT * FROM student";
    Statement stmt = db.createStatement();
    ResultSet results = stmt.executeQuery(sql);
    while (results.next()) {
    students.add(results);
    }
    }
    catch (Exception e) { e.printStackTrace(); }

    return students;
    }


    [flex code to map it to datagrid]

    <mx:RemoteObject id="studentRecords" destination="studentsService"/>

    <mx:Button label="get data" click="Student.getStudents()"/>
    <mx:DataGrid dataProvider="{studentRecords.getStudents.result}" >
    <mx:columns>
    <mx:DataGridColumn headerText="first name" dataField="firstname"/>
    <mx:DataGridColumn headerText="last name" dataField="lastname"/>
    <mx:DataGridColumn headerText="middle name" dataField="middlename"/>
    <mx:DataGridColumn headerText="email" dataField="email"/>
    </mx:columns>
    </mx:DataGrid>

    Anurag Mishra Guest

  2. #2

    Default Mapping Java ResultSet to Flex

    Hi,
    Please use <mx:DataGrid dataProvider="{studentRecords.getStudents.lastResu lt}" >
    insetead of <mx:DataGrid dataProvider="{studentRecords.getStudents.result}" >

    This will resolve your issue.
    Faisal Guest

Similar Threads

  1. java ResultSet size
    By monty in forum MySQL
    Replies: 2
    Last Post: September 30th, 09:13 AM
  2. flex with java
    By simbhu in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: April 5th, 03:38 PM
  3. [JAVA] - To Make training of JAVA, help me Underestand FLEX and AS 3.0 ?
    By Eduardo Burko - Dotmidia in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: August 31st, 02:33 PM
  4. mapping Flex ValueObjects to CFCs
    By toofless in forum Macromedia Flex General Discussion
    Replies: 4
    Last Post: January 22nd, 11:47 AM
  5. Replies: 5
    Last Post: July 25th, 05:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139