flex通过blazeds与java通信的小例子
很简单的小例子,适合初学者理解
1,JavaFlex.java
package flex;
public class JavaFlex {
public String helloJavaFlex(String name) {
return name;
}
}
2,remoting-config.xml
<?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="firstJavaFlex">
<properties>
<source>flex.JavaFlex
</source>
</properties>
</destination>
</service>
3,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:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:RemoteObject id="selectHello" destination="firstJavaFlex" fault="error(event)"/>
</fx:Declarations>
<fx:Script>
<!--[CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.ResizeEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var arraylist:ArrayCollection = new ArrayCollection([
{name:"你好",data:"你好!"},
{name:"你们好",data:"你们好!"},
{name:"大家好",data:"大家好!"},
]);
private function changehandler(event:Event):void{
selectHello.helloJavaFlex(selected.selectedItem.data);
selectHello.addEventListener(ResultEvent.RESULT,remoteResult);
}
private function remoteResult(event:ResultEvent):void{
Alert.show(event.result.toString());
resultmess.text = event.result.toString();
}
priv
相关文档:
反射的概念是由Smith在1982年首次提出的,主要是指程序可以访问、检测和修改它本身状态或行为的一种能力。这一概念的提出很快引发了计算机科学领域关于应用反射性的研究。它首先被程序语言的设计领域所采用,并在Lisp和面向对象方面取得了成绩。其中LEAD/LEAD++ 、OpenC++ 、MetaXa和OpenJava等就是基于反射机制的语言。最近 ......
import java.io.*;
public class IoTest
{
public static void main(String[] args)
{
String s;
s=calculate();
System.out.println(s);
}
static String calculate()
{
StringBuffer sb=new StringBuffer("");
try{
FileReader re ......
鉴于网上对Java的堆栈区分,众说纷纭,有的把C++的堆栈也混进来,有的没有分清Stack,Heap的中文翻译,搞得我把Stack当作堆,Heap当作栈,混乱了!昨天参加一外企的笔试,选择英文答案时,选错了,知道答案是堆,却选择了Stack!今天,决定把两者区分清楚!
&nbs ......
贴段代码,有少许注释:
package ibees;
import java.util.Arrays;
public class BinarySearch {
/**
* @param args
*/
public static void main(String[] args) {
double[] src = new double[]{1.3,9.9,10.89,12.89,89.0};
System.out.println(new BinarySearch().binarySearch(src, 89.0));
}
......
1.修改项目的.project文件,保存,刷新工程。
在<natures>
…
</natures>
之间添加下列三行配置
<nature>org.eclipse.wst.common.project.facet.core.nature</n ......