日期:2014-05-16 浏览次数:20431 次
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="jsonservice.send()"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import com.adobe.serialization.json.JSONDecoder; private function onJSONResult( event:ResultEvent ) : void { var data:String = event.result.toString(); data = data.replace( /\s/g, '' ); var jd:JSONDecoder = new JSONDecoder( data ); dg.dataProvider = jd.getValue(); } ]]> </mx:Script> <mx:HTTPService id="jsonservice" url="http://localhost:8080/jsp-examples/flexds/json.jsp" resultFormat="text" result="onJSONResult(event)" /> <mx:Panel title="Stock Data " width="100% " height="100% "> <mx:DataGrid id="dg" width="100%" height="100%"> <mx:columns> <mx:DataGridColumn dataField="compa " /> <mx:DataGridColumn dataField="compb " /> </mx:columns> </mx:DataGrid> </mx:Panel> </mx:Application><?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="jsonservice.send()"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import com.adobe.serialization.json.JSONDecoder; private function onJSONResult( event:ResultEvent ) : void { var data:String = event.result.toString(); data = data.replace( /\s/g, '' ); var jd:JSONDecoder = new JSONDecoder( data ); dg.dataProvider = jd.getValue(); } ]]> </mx:Script> <mx:HTTPService id="jsonservice" url="http://localhost:8080/jsp-examples/flexds/json.jsp" resultFormat="text" result="onJSONResult(event)" /> <mx:Panel title="Stock Data " width="100% " height="100% "> <mx:DataGrid id="dg" width="100%" height="100%"> <mx:columns> <mx:DataGridColumn dataField="compa " /> <mx:DataGridColumn dataField="compb " /> </mx:columns> </mx:DataGrid> </mx:Panel> </mx:Application>