加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex+java+blazeds传值问题

发布时间:2020-12-15 03:45:19 所属栏目:百科 来源:网络整理
导读:1.blazeds中的WEB-INF替换掉刚刚创建的web工程下的WEB-INF 2.写java类 3.创建flex工程 4.关联java类,在WEB-INF/flex/remoting-config.xml中添加 ?destination id="flexs" ? ? properties ? ? ? source ??java类 /source ? ? /properties ? /destination? id

1.blazeds中的WEB-INF替换掉刚刚创建的web工程下的WEB-INF

2.写java类

3.创建flex工程

4.关联java类,在WEB-INF/flex/remoting-config.xml中添加

?<destination id="flexs"> ?
? <properties> ?
? ? <source>
??java类</source> ?
? </properties> ?
</destination>?

id供flex调用

5.调用id

<fx:Declarations>
<mx:RemoteObject id="ts" destination="flexs"/>
</fx:Declarations>

id是本页调用

6.传值案列

protected function button1_clickHandler(event:MouseEvent):void
{
var str:String=t2.text;
ts.get(str);
Alert.show(str);
ts.getString();
ts.addEventListener(ResultEvent.RESULT,getROResult); ?

}
private function getROResult(e:ResultEvent) :void { ?
t1.text=e.result.toString();
} ?

java中get方法

public String getString(){
System.out.println("进来了");
return "HelloWorld";
}?
public String get(String str){
System.out.println(str);
return str+"HelloWorld";
}

7.总结

给java传值只需id.方法名

java给flex传值

要做一个监听方法,监听离它最近的方法,如

ts.get(str);

ts.addEventListener(ResultEvent.RESULT,getROResult); ?

得到的是get返回的值


QQ:563427828

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读