首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

最简略的flex+J2ee

2012-09-07 
最简单的flex+J2ee运行环境是:eclipse3.3+(我的是jee版本的)安装flex builder3 plugin插件(FB3_WWEJ_Plugi

最简单的flex+J2ee
运行环境是:
eclipse3.3+(我的是jee版本的)
安装flex builder3 plugin插件(FB3_WWEJ_Plugin.exe(google搜的到))
还要下载blazeds.war,解压也行,不解压也行。
OK。
下面创建flex-jee
新建一个flex project
输入名称,其他的不管,只选择application server type选择J2EE
next
选择你的tomcat
其他的不管,这个flex war file就是你的blazeds.war
OK,finish。
完成了。
现在在java src下面创建一个类:

package org.xlaohe1;public class T {public String s(String name) {return "Say: Hello!" + name;}}

OK
再去找你的web-inf下面的flex中的remoting-config.xml文件
在后面加上一句:
 <destination id="say">        <properties>            <source>org.xlaohe1.T</source>        </properties>    </destination>


OK.java方面成功了。
去flex-src下面修改你的mxml:
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"><mx:Script><![CDATA[import mx.rpc.events.ResultEvent;import mx.controls.Alert;import mx.rpc.events.FaultEvent;private function btnClick():void {sayRO.s(inputStr.text);}private function faultHandler(event:FaultEvent):void {ta.text = event.fault.toString();}private function sayHR(event:ResultEvent):void {ta.text = event.result.toString();}]]></mx:Script><mx:TextInput id="inputStr"  x="24" y="40"/><mx:Button id="btn" click="btnClick();"  x="209" y="40"/><mx:TextArea id="ta"  x="24" y="99"/><mx:RemoteObject id="sayRO" destination="say" fault="faultHandler(event)"><mx:method name="s"  result="sayHR(event)"/></mx:RemoteObject></mx:Application>


OK。
运行吧。
先放到tomcat,在运行flex。
如果运行无异常,配置无异常,单击按钮没反应或者出错,或路劲错误
请修改你的工程的flex server中的context root指向你的工程名
OK。
就这么简单。

有意见请留下来。

热点排行