---
title: "Flex 与java 通信,通过BlazeDS"
author: "klskdk"
date: "2012-07-01T09:43:13Z"
tags: []
categories: ["非技术"]
slug: "flex-java-blazeds"
draft: false
lastmod: "2012-07-01T09:43:13Z"
id: 1572729
url: "https://klskdk.iteye.com/blog/1572729"
---

1. Server代码  package com.east.flex.demo; import com.east.flex.Person; public class HelloWorld { public Person sayHello(String str) { Person p = new Person(); p.setId(2222222); p.setName("East"); p.setSex("man"); return p; } }  package com.east.flex; public class Person { private long id; private String name; private String sex; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public long getId() { return id; } public void setId(long id) { this.id = id; } }  2.Client 代码 package com.east.flex {  public class Person { public var id:Number; public var name:String; public var sex:String; public function Person() { } public function toStrings():String { trace("start Person"); return "ID :"+id+"Name :"+name+"Sex :"+sex; } } }   import com.east.flex.Person       RemoteObject id="helloService" endpoint="http://localhost:8080/java2/messagebroke r/amf" showBusyCursor="true" destination="helloWorld" result="showResult(event)">    3.config file             com.east.flex.demo.HelloWorld