在我的示例应用程序(java+Flex)Java 类方法中,例如..
public class Sample
{
public ArrayList method1()
{
ArrayList al =new ArrayList();
al.add("one");
al.add("TWO");
}
在 Flex 侧连接 Blazeds 连接......一切都已完美完成,我MXML file code
的是
public var userService:Sample = new Sample();
protected function init_Call(event:FlexEvent):void
{
var rpcSearchResult:AsyncToken = userService.method1();
rpcSearchResult.addResponder(new mx.rpc.Responder(success, failure));
}
[Bindable]public var ac:ArrayCollection = new ArrayCollection();
public function success(event:ResultEvent):void
{
ac=event.result as ArrayCollection;
Alert.show("Result : "+ac.getItemAt(0,0));
}
public function failure(event:FaultEvent):void
{
Alert.show("This is Fault Event");
}
……
<s:DataGrid id="dataGrid" left="12" right="12" top="49" bottom="54" horizontalCenter="0"
requestedRowCount="4" verticalCenter="-3" dataProvider="{ac}">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="one" headerText="FirstValue"></s:GridColumn>
<s:GridColumn dataField="two" headerText="SecondValue"></s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
但我在 DataGrid 上没有得到任何值,但 ResultEvent 函数 Alert 正确显示“一”、“二”值。