flex java blazeds_Flex3与java BlazeDS入门教程及其配置详解

新的下载路径:http://sourceforge.net/adobe/wiki/Projects/或是http://www.pc6.com/softview/SoftView_83105.html

有Tomcat的下载

http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-bin-3.2.0.3978.zip

没Tomcat的下载

http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-turnkey-3.2.0.3978.zip

下载后将blazeds.war部署到tomcat下即可。

Flex Builder插件的安装不再作介绍

开发工作为MyEclipse:

1.新建一个Flex工程

0818b9ca8b590ca3270a3433284dd417.png

按照图中进行配置

2.下一步:

0818b9ca8b590ca3270a3433284dd417.png

指定已经下载的blazeds.war

3.下一步.

0818b9ca8b590ca3270a3433284dd417.png

配置url

4.完成后右键配置工程属性:

0818b9ca8b590ca3270a3433284dd417.png

注意context的修改,不然运行程序会报404.

5.新建一个测试类:

package com;

public class HelloWorld

{

public String say(String username)

{

System.out.println("hello");

return "你好!" + username;

}

public String login(String username,String password)

{

System.out.println("login");

if(username.equals("admin") && password.equals("admin"))

{

return "success";

}

else

{

return "failure";

}

}

}

0818b9ca8b590ca3270a3433284dd417.png

6.配置web-inf/flex 下的remoting-config.xml文件:

0818b9ca8b590ca3270a3433284dd417.png

class="flex.messaging.services.RemotingService">

com.HelloWorld

7.编写mxml文件:

0818b9ca8b590ca3270a3433284dd417.png

import mx.rpc.events.ResultEvent;

import mx.controls.Alert;

//hello事件

private function helloClick():void

{

this.hello.say(this.username.text);

}

//登录事件

private function loginClick():void

{

this.login.login(this.username.text,this.password.text);

}

//处理hello事件 返回值

private function resultHandler(e:ResultEvent):void

{

Alert.show(e.result.toString());

}

//处理登录事件返回值

private function resultLoginHandler(e:ResultEvent):void

{

Alert.show(e.result as String);

}

]]>

7.找到bin-debug下的secondBlaze.html右键选择在Run on Server即可。

0818b9ca8b590ca3270a3433284dd417.png

由最代码官方编辑于2014-4-21 14:12:52

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值