用flex+BlazeDS做前端开发web入门小例
一,到http://opensource.adobe.com/wiki/display/blazeds/Downloads下载一个blazeds-turnkey-4.x.x.x.zip包 ? 二,打开Myeclise8.0新建一个javaweb工程,选择javaEE 5.0如图
? 三,右击WebRoot选择import->General->File system,导入BlazeDS中的文件(导入前先解压blazeds.war包) ? 四,将flexweb部署到tomcat中 ? 五,在flex builder中新建一个Flex项目flexweb ? 六,下一步配置你的服务器路径 ? 七,在myeclipse项目中 package test; public class Accptech { ? 八,配置Webroot/WEB-INF/flex/remoting-config.xml <destination id="mytest"> ? 九,在flex项目的flexweb?.mxml中 <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="1024" minHeight="768"> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; protected function myFlex_resultHandler(event:ResultEvent):void { var name:String=event.result as String; Alert.show(name); } protected function btnSend_clickHandler(event:MouseEvent):void { myFlex.helloWorld(txtName.text); } ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g.,services,value objects) here --> <s:RemoteObject id="myFlex" destination="mytest" result="myFlex_resultHandler(event)" /> </fx:Declarations> <s:Panel x="87" y="20" width="250" height="200" title="www.accptecg.com flex4"> <s:TextInput x="16" y="37" id="txtName"/> <s:Button x="168" y="38" label="发送" id="btnSend" click="btnSend_clickHandler(event)"/> </s:Panel> </s:Application>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |