国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
flex與java通過RemoteObject通信例子_Java_Blog.knowsky...

flash player 支持一種協(xié)議 AMF(action message format),這是一個二進制格式的協(xié)議,能夠替代用于傳輸xml的基本的協(xié)議而在http協(xié)議之上的交換數(shù)據(jù)。
BalzeDs中包含了AMF的java實現(xiàn),可以用來與服務(wù)器的java對象遠程交互,也可以在客戶端傳遞信息。BalzeDs能在很多基于java服務(wù)器上工作(tomcat,websphere,weblogic,jboss)
簡單的說BlazeDs是一個基于服務(wù)器的java遠程調(diào)用和web消息傳遞技術(shù),它能夠讓后臺的java應(yīng)用程序和運行在瀏覽器的flex進行通信。

----------------------------------例子如下

1:打開myEclipes,新建一個項目remotejf, src下建包com.test和類HelloJavaFlex

public class HelloJavaFlex {

public String hello(String name) {

return "hello,"+name+"通信了 哈哈";
}
}

2: 下載blazeDs.war,用winrar打開,拷貝WEB-INF到remotejf的webroot下,覆蓋原來的WEB-INF

3:找到WEB-INF下的remoting-config.xml 增加destination

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" class="flex.messaging.services.RemotingService">

<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>

<default-channels>
<channel ref="my-amf"/>
</default-channels>

<destination id="test">
<properties>
<source>com.test.HelloJavaFlex</source>
</properties>
</destination>

4 flash build下創(chuàng)建項目 testFlex, 打開testFlex.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="955" minHeight="600">

<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
protected function button1_clickHandler(event:MouseEvent):void
{
var nameText:String = textId.text;
remoteId.hello(nameText);
}
protected function remoteHello_resultHandler(event:ResultEvent):void
{
var name:String = event.result as String;
Alert.show(name);
}
]]>
</fx:Script>

<fx:Declarations>
<!-- 將非可視元素(例如服務(wù)、值對象)放在此處 -->
<s:RemoteObject id="remoteId" destination="test" result="remoteHello_resultHandler(event)" endpoint="http://localhost:8080/remotejf/messagebroker/amf">

</s:RemoteObject>
</fx:Declarations>
<s:Label x="228" y="134" text="姓名:" width="50" height="22"/>
<s:TextInput x="286" y="134" id="textId"/>
<s:Button x="286" y="206" label="jfbutton" width="74" click="button1_clickHandler(event)"/>
</s:Application>
5 啟動tomcat

6:運行testFlex.mxml

注意:按順序來啊

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Flex遠程調(diào)用機制RemoteObject應(yīng)用技巧
InfoQ: 使用BlazeDS和AMF構(gòu)建Web和桌面應(yīng)用
Flex 如何使用JAVA對象連接SQLServer數(shù)據(jù)庫
flex與java間用json傳輸數(shù)據(jù)
Flex RemoteObject 簡單應(yīng)用Demo
將 Flex 集成到 Java EE 應(yīng)用程序的最佳實踐
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服