The Backstage Java program returns a list type and the foreground's flex reads it, what about this?
Returns the Java code for the list
1 package com.duduli.li;
2
3 import java.util.ArrayList;
4 import java.util.Date;
5 import java.util.List;
6
7 public class Testlist {
8 @SuppressWarnings("unchecked")
9 public List returnList(){
10
11 Perl p = new Perl ();
12 p.setId(1);
13 p.setName ("tom");
14 p.setDate(new Date());
15
16 Perl p2 = new Perl();
17 p2.setId(2);
18 p2.setName("john");
19 p2.setDate(new Date());
20
21 Perl p3 = new Perl();
22 p3.setId(3);
23 p3.setName ("cate");
24 p3.setDate(new Date());
25
26 List<Perl> list = new ArrayList();
27 list.add(p);
28 list.add(p2);
29 list.add(p3);
30
31 return list;
32 }
Register well in Remoting-config.xml.
1 <destination id="returnlist">
2 <properties>
3 <source>com.duduli.li.Testlist</source>
4 </properties>
5 </destination>
The flex in the foreground is displayed in a DataGrid.
Use RemoteObject to invoke the registered destination.
<mx:RemoteObject id="rl" destination="returnlist" result="resultHandler (event)"/>