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

用flex+BlazeDS做前端开发web入门小例

发布时间:2020-12-15 04:50:13 所属栏目:百科 来源:网络整理
导读:一,到 http://opensource.adobe.com/wiki/display/blazeds/Downloads 下载一个blazeds-turnkey-4.x.x.x.zip包 ? 二, 打开Myeclise8.0 新建一个javaweb工程,选择javaEE 5.0如图 ? 三, 右击WebRoot 选择import-General -File system,导入BlazeDS中的文件

一,到http://opensource.adobe.com/wiki/display/blazeds/Downloads下载一个blazeds-turnkey-4.x.x.x.zip包

?

二,打开Myeclise8.0新建一个javaweb工程,选择javaEE 5.0如图

?

三,右击WebRoot选择import->General->File system,导入BlazeDS中的文件(导入前先解压blazeds.war包)

?

四,将flexweb部署到tomcat中

?

五,在flex builder中新建一个Flex项目flexweb

?

六,下一步配置你的服务器路径

?

七,在myeclipse项目中

package test;

public class Accptech {
?public String helloWorld(String message) {
??
??return message+",welcome to back!";
?}?????????????????????
}

?

八,配置Webroot/WEB-INF/flex/remoting-config.xml

<destination id="mytest">
??? <properties>
??????? <source>test.Accptech</source>
??? </properties>
?</destination>

?

九,在flex项目的flexweb?.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="1024" minHeight="768">
	
	<fx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			protected function myFlex_resultHandler(event:ResultEvent):void
			{
				var name:String=event.result as String;
				Alert.show(name);
			}
			
			protected function btnSend_clickHandler(event:MouseEvent):void
			{
				myFlex.helloWorld(txtName.text);
			}
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g.,services,value objects) here -->
		<s:RemoteObject id="myFlex" destination="mytest" result="myFlex_resultHandler(event)"  />
	</fx:Declarations>
	<s:Panel x="87" y="20" width="250" height="200" title="www.accptecg.com flex4">
		<s:TextInput x="16" y="37" id="txtName"/>
		<s:Button x="168" y="38" label="发送" id="btnSend" click="btnSend_clickHandler(event)"/>
	</s:Panel>

</s:Application>


十,启动tomcat,在flex项目中运行flexweb.mxml

(编辑:李大同)

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

    推荐文章
      热点阅读