Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
Anurag Mishra #1
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
-
java ResultSet size
let's say I did a simple query on a database like show tables; in java, i get a ResultSet how can I get the total number of rows in the ResultSet?... -
flex with java
i am new to flex1.5 i need some simple coding for connecting java objects and methods with flex components. my project is to develop a training... -
[JAVA] - To Make training of JAVA, help me Underestand FLEX and AS 3.0 ?
Do you finds that to make training of JAVA, it helps me to better understand the FLEX and the 3.0? Or it does not make much difference? Sorry... -
mapping Flex ValueObjects to CFCs
First, my setup is ColdFusion MX7 and Flex 1.5 sharing the same context root (/) on JRun4 (updater 6). I have been having (what I think are)... -
JDBC ResultSet - Where is its stored? DB2 client app or Java program's JVM?
When a Java program executes a SQL query using JDBC, is the ResultSet data stored in the DB2 Client process or in the JVM for the Java program? The... -
Faisal #2
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



Reply With Quote

